aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 57ae4ace..7d3e3649 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2680,7 +2680,6 @@ static ALvoid InitContext(ALCcontext *Context)
*/
static void FreeContext(ALCcontext *context)
{
- static const AsyncEvent kill_evt = ASYNC_EVENT(EventType_KillThread);
ALlistener *listener = context->Listener;
struct ALeffectslotArray *auxslots;
struct ALeffectslotProps *eprops;
@@ -2692,11 +2691,6 @@ static void FreeContext(ALCcontext *context)
TRACE("%p\n", context);
- while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0)
- althrd_yield();
- alsem_post(&context->EventSem);
- althrd_join(context->EventThread, NULL);
-
if((cprops=ATOMIC_LOAD(&context->Update, almemory_order_acquire)) != NULL)
{
TRACE("Freed unapplied context update %p\n", cprops);
@@ -2809,6 +2803,7 @@ static void FreeContext(ALCcontext *context)
*/
static bool ReleaseContext(ALCcontext *context, ALCdevice *device)
{
+ static const AsyncEvent kill_evt = ASYNC_EVENT(EventType_KillThread);
ALCcontext *origctx, *newhead;
bool ret = true;
@@ -2841,6 +2836,11 @@ static bool ReleaseContext(ALCcontext *context, ALCdevice *device)
ret = !!newhead;
V0(device->Backend,unlock)();
+ while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0)
+ althrd_yield();
+ alsem_post(&context->EventSem);
+ althrd_join(context->EventThread, NULL);
+
ALCcontext_DecRef(context);
return ret;
}