aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alc.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-18 18:04:27 -0800
committerChris Robinson <[email protected]>2018-11-18 18:04:27 -0800
commitb10e7d08c34bc6d46aaf61ef2a0183e7841b75f3 (patch)
tree52ec62d347eab96dc64beef40fcbfa6bdf7db905 /Alc/alc.cpp
parentef7995cfd086dd1b32d85bf214b66da37e6550c5 (diff)
Use a std::thread for the event thread
Diffstat (limited to 'Alc/alc.cpp')
-rw-r--r--Alc/alc.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index 86150794..5de72b4c 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -2581,8 +2581,7 @@ static ALvoid InitContext(ALCcontext *Context)
Context->AsyncEvents = ll_ringbuffer_create(63, sizeof(AsyncEvent), false);
- if(althrd_create(&Context->EventThread, EventThread, Context) != althrd_success)
- ERR("Failed to start event thread! Expect problems.\n");
+ StartEventThrd(Context);
}
@@ -2696,7 +2695,6 @@ ALCcontext_struct::~ALCcontext_struct()
*/
static bool ReleaseContext(ALCcontext *context, ALCdevice *device)
{
- static const AsyncEvent kill_evt = ASYNC_EVENT(EventType_KillThread);
ALCcontext *origctx, *newhead;
bool ret = true;
@@ -2734,10 +2732,7 @@ static bool ReleaseContext(ALCcontext *context, ALCdevice *device)
* this, although waiting for a non-odd mix count would work too.
*/
- while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0)
- althrd_yield();
- alsem_post(&context->EventSem);
- althrd_join(context->EventThread, nullptr);
+ StopEventThrd(context);
ALCcontext_DecRef(context);
return ret;