diff options
author | Chris Robinson <[email protected]> | 2011-08-29 13:22:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-29 13:22:07 -0700 |
commit | 72beb577b6190d9df0426825f131a5c8624aaeec (patch) | |
tree | fbc6653d88aee582cc7a5751ecc48762c82fa544 /OpenAL32/alState.c | |
parent | de65ee08c9c3b2261b8329d45cb57b4b4e5cb6a1 (diff) |
Lock the context as needed for the defer and process calls
Diffstat (limited to 'OpenAL32/alState.c')
-rw-r--r-- | OpenAL32/alState.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 7e73f407..a65eaa82 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -577,7 +577,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) { ALCcontext *Context; - Context = GetLockedContext(); + Context = GetReffedContext(); if(!Context) return; if(!Context->DeferUpdates) @@ -587,11 +587,11 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) ALeffectslot *ALEffectSlot; ALsizei e; + LockContext(Context); Context->DeferUpdates = AL_TRUE; /* Make sure all pending updates are performed */ - UpdateSources = Context->UpdateSources; - Context->UpdateSources = AL_FALSE; + UpdateSources = Exchange_ALenum(&Context->UpdateSources, AL_FALSE); src = Context->ActiveSources; src_end = src + Context->ActiveSourceCount; @@ -616,24 +616,24 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) if(Exchange_ALenum(&ALEffectSlot->NeedsUpdate, AL_FALSE)) ALEffect_Update(ALEffectSlot->EffectState, Context, ALEffectSlot); } + UnlockContext(Context); } - UnlockContext(Context); + ALCcontext_DecRef(Context); } AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void) { ALCcontext *Context; - Context = GetLockedContext(); + Context = GetReffedContext(); if(!Context) return; - if(Context->DeferUpdates) + if(Exchange_ALenum(&Context->DeferUpdates, AL_FALSE)) { ALsizei pos; - Context->DeferUpdates = AL_FALSE; - + LockContext(Context); for(pos = 0;pos < Context->SourceMap.size;pos++) { ALsource *Source = Context->SourceMap.array[pos].value; @@ -647,7 +647,8 @@ AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void) if(new_state) SetSourceState(Source, Context, new_state); } + UnlockContext(Context); } - UnlockContext(Context); + ALCcontext_DecRef(Context); } |