diff options
author | Chris Robinson <[email protected]> | 2011-08-29 00:50:55 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-29 00:50:55 -0700 |
commit | 58078e2c1eb2a3778462c1d0632b0a2c85fe82ec (patch) | |
tree | 434158738f276fd2ef6f1c855fa895044a348822 /Alc/ALu.c | |
parent | 01503f8a7bd99136445008eba5bed5af483a7aea (diff) |
Use atomic exchanges when checking for updates to objects' internal parameters
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 20 |
1 files changed, 6 insertions, 14 deletions
@@ -978,14 +978,11 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) ctx = device->ContextList; while(ctx) { - ALboolean DeferUpdates = ctx->DeferUpdates; - ALboolean UpdateSources = AL_FALSE; + ALenum DeferUpdates = ctx->DeferUpdates; + ALenum UpdateSources = AL_FALSE; if(!DeferUpdates) - { - UpdateSources = ctx->UpdateSources; - ctx->UpdateSources = AL_FALSE; - } + UpdateSources = Exchange_ALenum(&ctx->UpdateSources, AL_FALSE); src = ctx->ActiveSources; src_end = src + ctx->ActiveSourceCount; @@ -998,11 +995,9 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) continue; } - if(!DeferUpdates && ((*src)->NeedsUpdate || UpdateSources)) - { - (*src)->NeedsUpdate = AL_FALSE; + if(!DeferUpdates && (Exchange_ALenum(&(*src)->NeedsUpdate, AL_FALSE) || + UpdateSources)) ALsource_Update(*src, ctx); - } MixSource(*src, device, SamplesToDo); src++; @@ -1024,11 +1019,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) ALEffectSlot->PendingClicks[i] = 0.0f; } - if(!DeferUpdates && ALEffectSlot->NeedsUpdate) - { - ALEffectSlot->NeedsUpdate = AL_FALSE; + if(!DeferUpdates && Exchange_ALenum(&ALEffectSlot->NeedsUpdate, AL_FALSE)) ALEffect_Update(ALEffectSlot->EffectState, ctx, ALEffectSlot); - } ALEffect_Process(ALEffectSlot->EffectState, ALEffectSlot, SamplesToDo, ALEffectSlot->WetBuffer, |