diff options
-rw-r--r-- | Alc/alc.cpp | 7 | ||||
-rw-r--r-- | Alc/alcontext.h | 2 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/alListener.cpp | 24 | ||||
-rw-r--r-- | OpenAL32/alSource.cpp | 24 | ||||
-rw-r--r-- | OpenAL32/alState.cpp | 26 | ||||
-rw-r--r-- | OpenAL32/event.cpp | 2 |
7 files changed, 43 insertions, 46 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 485ab88e..d6331862 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1616,7 +1616,7 @@ void ALCcontext_DeferUpdates(ALCcontext *context) */ void ALCcontext_ProcessUpdates(ALCcontext *context) { - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(context->DeferUpdates.exchange(false)) { /* Tell the mixer to stop applying updates, then wait for any active @@ -2260,7 +2260,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) UpdateEffectSlotProps(slot, context); } - std::unique_lock<almtx_t> proplock{context->PropLock}; + std::unique_lock<std::mutex> proplock{context->PropLock}; std::unique_lock<almtx_t> slotlock{context->EffectSlotLock}; for(auto &slot : context->EffectSlotList) { @@ -2513,7 +2513,6 @@ static ALvoid InitContext(ALCcontext *Context) struct ALeffectslotArray *auxslots; //Validate Context - almtx_init(&Context->PropLock, almtx_plain); almtx_init(&Context->SourceLock, almtx_plain); almtx_init(&Context->EffectSlotLock, almtx_plain); @@ -2660,8 +2659,6 @@ ALCcontext_struct::~ALCcontext_struct() ll_ringbuffer_free(AsyncEvents); AsyncEvents = nullptr; - almtx_destroy(&PropLock); - ALCdevice_DecRef(Device); } diff --git a/Alc/alcontext.h b/Alc/alcontext.h index 056d9003..0b285bfb 100644 --- a/Alc/alcontext.h +++ b/Alc/alcontext.h @@ -84,7 +84,7 @@ struct ALCcontext_struct { std::atomic_flag PropsClean{true}; std::atomic<bool> DeferUpdates{false}; - almtx_t PropLock; + std::mutex PropLock; /* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit * indicates if updates are currently happening). diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp index 43e99584..539329a7 100644 --- a/OpenAL32/alAuxEffectSlot.cpp +++ b/OpenAL32/alAuxEffectSlot.cpp @@ -287,7 +287,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->EffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) @@ -358,7 +358,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->EffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) diff --git a/OpenAL32/alListener.cpp b/OpenAL32/alListener.cpp index 2d3482bf..c86c8374 100644 --- a/OpenAL32/alListener.cpp +++ b/OpenAL32/alListener.cpp @@ -43,7 +43,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value) if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; switch(param) { case AL_GAIN: @@ -76,7 +76,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; switch(param) { case AL_POSITION: @@ -125,7 +125,7 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!values) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "NULL pointer"); switch(param) { @@ -154,7 +154,7 @@ AL_API ALvoid AL_APIENTRY alListeneri(ALenum param, ALint UNUSED(value)) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; switch(param) { default: @@ -176,7 +176,7 @@ AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, A ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; switch(param) { default: @@ -212,7 +212,7 @@ AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!values) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -229,7 +229,7 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!value) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -254,7 +254,7 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!value1 || !value2 || !value3) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -296,7 +296,7 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!values) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -322,7 +322,7 @@ AL_API ALvoid AL_APIENTRY alGetListeneri(ALenum param, ALint *value) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!value) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -339,7 +339,7 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!value1 || !value2 || !value3) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -376,7 +376,7 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) if(UNLIKELY(!context)) return; ALlistener &listener = context->Listener; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; if(!values) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index 0515074c..bbcd318e 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -2192,7 +2192,7 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2208,7 +2208,7 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1 ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2227,7 +2227,7 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2246,7 +2246,7 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2265,7 +2265,7 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2284,7 +2284,7 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2314,7 +2314,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2330,7 +2330,7 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2349,7 +2349,7 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) @@ -2368,7 +2368,7 @@ AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SO ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) @@ -2384,7 +2384,7 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) @@ -2403,7 +2403,7 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<almtx_t> __{context->SourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) diff --git a/OpenAL32/alState.cpp b/OpenAL32/alState.cpp index e2cd96d6..37bddea3 100644 --- a/OpenAL32/alState.cpp +++ b/OpenAL32/alState.cpp @@ -79,7 +79,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; switch(capability) { case AL_SOURCE_DISTANCE_MODEL: @@ -97,7 +97,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; switch(capability) { case AL_SOURCE_DISTANCE_MODEL: @@ -115,7 +115,7 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return AL_FALSE; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; ALboolean value{AL_FALSE}; switch(capability) { @@ -135,7 +135,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return AL_FALSE; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; ALboolean value{AL_FALSE}; switch(pname) { @@ -190,7 +190,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0.0; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; ALdouble value{0.0}; switch(pname) { @@ -239,7 +239,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0.0f; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; ALfloat value{0.0f}; switch(pname) { @@ -288,7 +288,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; ALint value{0}; switch(pname) { @@ -337,7 +337,7 @@ extern "C" AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; ALint64SOFT value{0}; switch(pname) { @@ -386,7 +386,7 @@ AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return nullptr; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; void *value{nullptr}; switch(pname) { @@ -648,7 +648,7 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value) alSetError(context.get(), AL_INVALID_VALUE, "Doppler factor %f out of range", value); else { - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; context->DopplerFactor = value; DO_UPDATEPROPS(); } @@ -675,7 +675,7 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) alSetError(context.get(), AL_INVALID_VALUE, "Doppler velocity %f out of range", value); else { - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; context->DopplerVelocity = value; DO_UPDATEPROPS(); } @@ -690,7 +690,7 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat value) alSetError(context.get(), AL_INVALID_VALUE, "Speed of sound %f out of range", value); else { - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; context->SpeedOfSound = value; DO_UPDATEPROPS(); } @@ -708,7 +708,7 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value) alSetError(context.get(), AL_INVALID_VALUE, "Distance model 0x%04x out of range", value); else { - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; context->mDistanceModel = static_cast<DistanceModel>(value); if(!context->SourceDistanceModel) DO_UPDATEPROPS(); diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp index 0491c7c6..233794bd 100644 --- a/OpenAL32/event.cpp +++ b/OpenAL32/event.cpp @@ -135,7 +135,7 @@ AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *user ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<almtx_t> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->PropLock}; std::lock_guard<std::mutex> __{context->EventCbLock}; context->EventCb = callback; context->EventParam = userParam; |