diff options
author | Chris Robinson <[email protected]> | 2018-11-21 06:41:49 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-21 06:41:49 -0800 |
commit | de4bb7aca10e6f206b82385b78312fdd86301a62 (patch) | |
tree | bf88b97b2a2846761efdcbaf314b31265e907f74 /Alc/alc.cpp | |
parent | 75213ee6f951355906bd1744a2936bb764f23e40 (diff) |
Replace a couple more almtx_lock/unlock calls
Diffstat (limited to 'Alc/alc.cpp')
-rw-r--r-- | Alc/alc.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 28c9bc6f..1979f33b 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1613,7 +1613,7 @@ void ALCcontext_DeferUpdates(ALCcontext *context) */ void ALCcontext_ProcessUpdates(ALCcontext *context) { - almtx_lock(&context->PropLock); + std::lock_guard<almtx_t> _{context->PropLock}; if(context->DeferUpdates.exchange(false)) { /* Tell the mixer to stop applying updates, then wait for any active @@ -1635,7 +1635,6 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) */ ATOMIC_STORE_SEQ(&context->HoldUpdates, AL_FALSE); } - almtx_unlock(&context->PropLock); } @@ -2262,7 +2261,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) UpdateEffectSlotProps(slot, context); } - almtx_lock(&context->PropLock); + std::unique_lock<almtx_t> proplock{context->PropLock}; std::unique_lock<almtx_t> slotlock{context->EffectSlotLock}; for(auto &slot : context->EffectSlotList) { @@ -2277,7 +2276,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } slotlock.unlock(); - almtx_lock(&context->SourceLock); + std::unique_lock<almtx_t> srclock{context->SourceLock}; for(auto &sublist : context->SourceList) { uint64_t usemask = ~sublist.FreeMask; @@ -2345,14 +2344,13 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) NfcFilterCreate(&voice->Direct.Params[i].NFCtrlFilter, 0.0f, w1); } } - almtx_unlock(&context->SourceLock); + srclock.unlock(); context->PropsClean.test_and_set(std::memory_order_release); UpdateContextProps(context); context->Listener.PropsClean.test_and_set(std::memory_order_release); UpdateListenerProps(context); UpdateAllSourceProps(context); - almtx_unlock(&context->PropLock); context = ATOMIC_LOAD(&context->next, almemory_order_relaxed); } |