diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alc.cpp | 3 | ||||
-rw-r--r-- | Alc/alcontext.h | 2 | ||||
-rw-r--r-- | Alc/alu.cpp | 6 | ||||
-rw-r--r-- | Alc/mixvoice.cpp | 2 |
4 files changed, 5 insertions, 8 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index ba693616..59ff2306 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -2528,7 +2528,6 @@ static ALvoid InitContext(ALCcontext *Context) Context->DopplerVelocity = 1.0f; Context->SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; Context->MetersPerUnit = AL_DEFAULT_METERS_PER_UNIT; - alsem_init(&Context->EventSem, 0); Context->ExtensionList = alExtList; @@ -2642,8 +2641,6 @@ ALCcontext_struct::~ALCcontext_struct() } TRACE("Freed " SZFMT " listener property object%s\n", count, (count==1)?"":"s"); - alsem_destroy(&EventSem); - ll_ringbuffer_free(AsyncEvents); AsyncEvents = nullptr; diff --git a/Alc/alcontext.h b/Alc/alcontext.h index 274888e0..7b7688ac 100644 --- a/Alc/alcontext.h +++ b/Alc/alcontext.h @@ -111,7 +111,7 @@ struct ALCcontext_struct { std::atomic<ALeffectslotArray*> ActiveAuxSlots{nullptr}; std::thread EventThread; - alsem_t EventSem; + al::semaphore EventSem; ll_ringbuffer *AsyncEvents{nullptr}; std::atomic<ALbitfieldSOFT> EnabledEvts{0u}; std::mutex EventCbLock; diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 5036ae24..c7ed0878 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -313,7 +313,7 @@ void SendSourceStoppedEvent(ALCcontext *context, ALuint id) strcpy(evt.u.user.msg+strpos, " state changed to AL_STOPPED"); if(ll_ringbuffer_write(context->AsyncEvents, &evt, 1) == 1) - alsem_post(&context->EventSem); + context->EventSem.post(); } @@ -441,7 +441,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) props->State = NULL; if(LIKELY(ll_ringbuffer_write(context->AsyncEvents, &evt, 1) != 0)) - alsem_post(&context->EventSem); + context->EventSem.post(); else { /* If writing the event failed, the queue was probably full. @@ -1857,7 +1857,7 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) ALbitfieldSOFT enabledevt = ctx->EnabledEvts.load(std::memory_order_acquire); if((enabledevt&EventType_Disconnected) && ll_ringbuffer_write(ctx->AsyncEvents, &evt, 1) == 1) - alsem_post(&ctx->EventSem); + ctx->EventSem.post(); std::for_each(ctx->Voices, ctx->Voices+ctx->VoiceCount.load(std::memory_order_acquire), [ctx](ALvoice *voice) -> void diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 86de61ee..1aa3000b 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -204,7 +204,7 @@ static void SendAsyncEvent(ALCcontext *context, ALuint enumtype, ALenum type, evt.u.user.param = param; strcpy(evt.u.user.msg, msg); if(ll_ringbuffer_write(context->AsyncEvents, &evt, 1) == 1) - alsem_post(&context->EventSem); + context->EventSem.post(); } |