diff options
author | Chris Robinson <[email protected]> | 2018-01-30 12:34:25 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-30 12:34:25 -0800 |
commit | 0394d5a44fd5b1c90c7e4ae9d660bec8a19175f1 (patch) | |
tree | 02663d4f7064ba80d0edbe3e2c0b678b4aa1f13a | |
parent | e7217760f39071c7aec542c8f3fbaad21c71924a (diff) |
Rename EventLock to make it more clear it's protecting the callback
-rw-r--r-- | Alc/ALc.c | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/alError.c | 4 | ||||
-rw-r--r-- | OpenAL32/alState.c | 4 | ||||
-rw-r--r-- | OpenAL32/event.c | 6 |
5 files changed, 9 insertions, 11 deletions
@@ -2611,7 +2611,7 @@ static ALvoid InitContext(ALCcontext *Context) Context->MetersPerUnit = AL_DEFAULT_METERS_PER_UNIT; ATOMIC_FLAG_TEST_AND_SET(&Context->PropsClean, almemory_order_relaxed); ATOMIC_INIT(&Context->DeferUpdates, AL_FALSE); - almtx_init(&Context->EventLock, almtx_plain); + almtx_init(&Context->EventCbLock, almtx_plain); ATOMIC_INIT(&Context->EnabledEvts, 0); Context->EventCb = NULL; Context->EventParam = NULL; @@ -2743,7 +2743,7 @@ static void FreeContext(ALCcontext *context) } TRACE("Freed "SZFMT" listener property object%s\n", count, (count==1)?"":"s"); - almtx_destroy(&context->EventLock); + almtx_destroy(&context->EventCbLock); ALCdevice_DecRef(context->Device); context->Device = NULL; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index ef5ad0e9..6ad67b7b 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -664,7 +664,7 @@ struct ALCcontext_struct { ATOMIC(struct ALeffectslotArray*) ActiveAuxSlots; - almtx_t EventLock; + almtx_t EventCbLock; ATOMIC(ALbitfieldSOFT) EnabledEvts; ALEVENTPROCSOFT EventCb; void *EventParam; diff --git a/OpenAL32/alError.c b/OpenAL32/alError.c index 22aed458..b6208f77 100644 --- a/OpenAL32/alError.c +++ b/OpenAL32/alError.c @@ -75,12 +75,12 @@ void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...) if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Error)) { ALbitfieldSOFT enabledevts; - almtx_lock(&context->EventLock); + almtx_lock(&context->EventCbLock); enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); if((enabledevts&EventType_Error) && context->EventCb) (*context->EventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg, context->EventParam); - almtx_unlock(&context->EventLock); + almtx_unlock(&context->EventCbLock); } } diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 10fce3b5..8448e548 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -722,12 +722,12 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) "alDopplerVelocity is deprecated in AL1.1, use alSpeedOfSound"; const ALsizei msglen = (ALsizei)strlen(msg); ALbitfieldSOFT enabledevts; - almtx_lock(&context->EventLock); + almtx_lock(&context->EventCbLock); enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); if((enabledevts&EventType_Deprecated) && context->EventCb) (*context->EventCb)(AL_EVENT_TYPE_DEPRECATED_SOFT, 0, 0, msglen, msg, context->EventParam); - almtx_unlock(&context->EventLock); + almtx_unlock(&context->EventCbLock); } if(!(value >= 0.0f && isfinite(value))) diff --git a/OpenAL32/event.c b/OpenAL32/event.c index 93d68d7a..9a3a92b4 100644 --- a/OpenAL32/event.c +++ b/OpenAL32/event.c @@ -37,7 +37,6 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid event type 0x%04x", types[i]); } - almtx_lock(&context->EventLock); if(enable) { ALbitfieldSOFT enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); @@ -57,7 +56,6 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A { } } - almtx_unlock(&context->EventLock); done: ALCcontext_DecRef(context); @@ -70,10 +68,10 @@ AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *user context = GetContextRef(); if(!context) return; - almtx_lock(&context->EventLock); + almtx_lock(&context->EventCbLock); context->EventCb = callback; context->EventParam = userParam; - almtx_unlock(&context->EventLock); + almtx_unlock(&context->EventCbLock); ALCcontext_DecRef(context); } |