diff options
author | Chris Robinson <[email protected]> | 2011-08-29 19:44:40 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-29 20:05:50 -0700 |
commit | 8eaa9bb4691dbd479236771064b958bedcdab145 (patch) | |
tree | 514f8630df3deab4e23301eb7dea46b11e4858ba /Alc | |
parent | b283dd3682e5c56483e69c4b65e889563e95d8c0 (diff) |
Manually lock the map while iterating through its contents
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 7 | ||||
-rw-r--r-- | Alc/ALu.c | 2 |
2 files changed, 9 insertions, 0 deletions
@@ -434,6 +434,7 @@ BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) break; case DLL_THREAD_DETACH: + ReadLock(&TlsDestructor.lock); for(i = 0;i < TlsDestructor.size;i++) { void *ptr = pthread_getspecific(TlsDestructor.array[i].key); @@ -441,6 +442,7 @@ BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) if(ptr && callback) callback(ptr); } + ReadUnlock(&TlsDestructor.lock); break; case DLL_PROCESS_DETACH: @@ -1237,12 +1239,14 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ALsizei pos; context->UpdateSources = AL_FALSE; + ReadLock(&context->EffectSlotMap.lock); for(pos = 0;pos < context->EffectSlotMap.size;pos++) { ALeffectslot *slot = context->EffectSlotMap.array[pos].value; if(ALEffect_DeviceUpdate(slot->EffectState, device) == AL_FALSE) { + ReadUnlock(&context->EffectSlotMap.lock); UnlockDevice(device); ALCdevice_StopPlayback(device); device->Flags &= ~DEVICE_RUNNING; @@ -1251,7 +1255,9 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) slot->NeedsUpdate = AL_FALSE; ALEffect_Update(slot->EffectState, context, slot); } + ReadUnlock(&context->EffectSlotMap.lock); + ReadLock(&context->SourceMap.lock); for(pos = 0;pos < context->SourceMap.size;pos++) { ALsource *source = context->SourceMap.array[pos].value; @@ -1268,6 +1274,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) source->NeedsUpdate = AL_FALSE; ALsource_Update(source, context); } + ReadUnlock(&context->SourceMap.lock); context = context->next; } @@ -1123,6 +1123,7 @@ ALvoid aluHandleDisconnect(ALCdevice *device) ALsource *source; ALsizei pos; + ReadLock(&Context->SourceMap.lock); for(pos = 0;pos < Context->SourceMap.size;pos++) { source = Context->SourceMap.array[pos].value; @@ -1134,6 +1135,7 @@ ALvoid aluHandleDisconnect(ALCdevice *device) source->position_fraction = 0; } } + ReadUnlock(&Context->SourceMap.lock); Context = Context->next; } |