diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2018-11-13 20:26:32 -0800 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2018-11-13 20:26:32 -0800 |
commit | a5f68c21214e6f85ade835cd29045026797ac2a4 (patch) | |
tree | 3b995975906303cfc42b8dc3054f3bbed632dbbb /Alc/ALc.c | |
parent | 5867c7b8c213aa47659e7c6e6cafddc643d9ea76 (diff) |
Avoid using ATOMIC_FLAG
Although it cant potentially be better than a regular atomic, it presents
compatibility issues when non-C11 atomics are mixed with C++
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1624,9 +1624,9 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) while((ATOMIC_LOAD(&context->UpdateCount, almemory_order_acquire)&1) != 0) althrd_yield(); - if(!ATOMIC_FLAG_TEST_AND_SET(&context->PropsClean, almemory_order_acq_rel)) + if(!ATOMIC_EXCHANGE(&context->PropsClean, AL_TRUE, almemory_order_acq_rel)) UpdateContextProps(context); - if(!ATOMIC_FLAG_TEST_AND_SET(&context->Listener->PropsClean, almemory_order_acq_rel)) + if(!ATOMIC_EXCHANGE(&context->Listener->PropsClean, AL_TRUE, almemory_order_acq_rel)) UpdateListenerProps(context); UpdateAllEffectSlotProps(context); UpdateAllSourceProps(context); @@ -2330,7 +2330,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } } - ATOMIC_FLAG_CLEAR(&source->PropsClean, almemory_order_release); + ATOMIC_STORE(&source->PropsClean, AL_FALSE, almemory_order_release); } } @@ -2367,9 +2367,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } almtx_unlock(&context->SourceLock); - ATOMIC_FLAG_TEST_AND_SET(&context->PropsClean, almemory_order_release); + ATOMIC_STORE(&context->PropsClean, AL_TRUE, almemory_order_release); UpdateContextProps(context); - ATOMIC_FLAG_TEST_AND_SET(&context->Listener->PropsClean, almemory_order_release); + ATOMIC_STORE(&context->Listener->PropsClean, AL_TRUE, almemory_order_release); UpdateListenerProps(context); UpdateAllSourceProps(context); almtx_unlock(&context->PropLock); @@ -2606,7 +2606,7 @@ static ALvoid InitContext(ALCcontext *Context) listener->Up[0] = 0.0f; listener->Up[1] = 1.0f; listener->Up[2] = 0.0f; - ATOMIC_FLAG_TEST_AND_SET(&listener->PropsClean, almemory_order_relaxed); + ATOMIC_INIT(&listener->PropsClean, AL_TRUE); ATOMIC_INIT(&listener->Update, NULL); @@ -2642,7 +2642,7 @@ static ALvoid InitContext(ALCcontext *Context) Context->DopplerVelocity = 1.0f; Context->SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; Context->MetersPerUnit = AL_DEFAULT_METERS_PER_UNIT; - ATOMIC_FLAG_TEST_AND_SET(&Context->PropsClean, almemory_order_relaxed); + ATOMIC_INIT(&Context->PropsClean, AL_TRUE); ATOMIC_INIT(&Context->DeferUpdates, AL_FALSE); alsem_init(&Context->EventSem, 0); Context->AsyncEvents = NULL; |