Update some atomic memory ordering

This commit is contained in:
Chris Robinson 2016-11-21 21:38:49 -08:00
parent a502a41be3
commit 8bf4fe2eea
2 changed files with 11 additions and 8 deletions

View File

@ -293,11 +293,12 @@ static ALboolean CalcListenerParams(ALCcontext *Context)
* in the old container (practically impossible with this little code,
* but...).
*/
first = ATOMIC_LOAD(&Listener->FreeList);
first = ATOMIC_LOAD(&Listener->FreeList, almemory_order_acquire);
do {
ATOMIC_STORE(&props->next, first, almemory_order_relaxed);
} while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*,
&Listener->FreeList, &first, props) == 0);
&Listener->FreeList, &first, props, almemory_order_acq_rel,
almemory_order_acquire) == 0);
return AL_TRUE;
}
@ -341,11 +342,12 @@ static ALboolean CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device)
* in the old container (practically impossible with this little code,
* but...).
*/
first = ATOMIC_LOAD(&slot->FreeList);
first = ATOMIC_LOAD(&slot->FreeList, almemory_order_acquire);
do {
ATOMIC_STORE(&props->next, first, almemory_order_relaxed);
} while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*,
&slot->FreeList, &first, props) == 0);
&slot->FreeList, &first, props, almemory_order_acq_rel,
almemory_order_acquire) == 0);
return AL_TRUE;
}
@ -1314,11 +1316,12 @@ static void CalcSourceParams(ALvoice *voice, ALCcontext *context, ALboolean forc
* actually swap in the old container (practically impossible with this
* little code, but...).
*/
first = ATOMIC_LOAD(&source->FreeList);
first = ATOMIC_LOAD(&source->FreeList, almemory_order_acquire);
do {
ATOMIC_STORE(&props->next, first, almemory_order_relaxed);
} while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*,
&source->FreeList, &first, props) == 0);
&source->FreeList, &first, props, almemory_order_acq_rel,
almemory_order_acquire) == 0);
}
BufferListItem = ATOMIC_LOAD(&source->queue, almemory_order_relaxed);

View File

@ -399,7 +399,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
/* Get source info */
State = AL_PLAYING; /* Only called while playing. */
BufferListItem = ATOMIC_LOAD(&Source->current_buffer);
BufferListItem = ATOMIC_LOAD(&Source->current_buffer, almemory_order_acquire);
DataPosInt = ATOMIC_LOAD(&Source->position, almemory_order_relaxed);
DataPosFrac = ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed);
Looping = ATOMIC_LOAD(&Source->looping, almemory_order_relaxed);
@ -696,5 +696,5 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
Source->state = State;
ATOMIC_STORE(&Source->current_buffer, BufferListItem, almemory_order_relaxed);
ATOMIC_STORE(&Source->position, DataPosInt, almemory_order_relaxed);
ATOMIC_STORE(&Source->position_fraction, DataPosFrac);
ATOMIC_STORE(&Source->position_fraction, DataPosFrac, almemory_order_release);
}