aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-29 20:21:28 -0700
committerChris Robinson <[email protected]>2011-08-29 20:21:28 -0700
commite4a2b69b37dcefcf2939bc020421daa467a64f43 (patch)
tree233dd2d7aed50420392ee4eca9a12c7d2530c2a7 /OpenAL32
parent8eaa9bb4691dbd479236771064b958bedcdab145 (diff)
Make specific functions to lock/unlock UIntMap access
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h8
-rw-r--r--OpenAL32/alState.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index fd645218..9a7c1cc4 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -322,6 +322,14 @@ ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
void RemoveUIntMapKey(UIntMap *map, ALuint key);
ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
+static __inline void LockUIntMapRead(UIntMap *map)
+{ ReadLock(&map->lock); }
+static __inline void UnlockUIntMapRead(UIntMap *map)
+{ ReadUnlock(&map->lock); }
+static __inline void LockUIntMapWrite(UIntMap *map)
+{ WriteLock(&map->lock); }
+static __inline void UnlockUIntMapWrite(UIntMap *map)
+{ WriteUnlock(&map->lock); }
#include "alListener.h"
#include "alu.h"
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 424a73f6..76628038 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -610,14 +610,14 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
src++;
}
- ReadLock(&Context->EffectSlotMap.lock);
+ LockUIntMapRead(&Context->EffectSlotMap);
for(e = 0;e < Context->EffectSlotMap.size;e++)
{
ALEffectSlot = Context->EffectSlotMap.array[e].value;
if(Exchange_ALenum(&ALEffectSlot->NeedsUpdate, AL_FALSE))
ALEffect_Update(ALEffectSlot->EffectState, Context, ALEffectSlot);
}
- ReadUnlock(&Context->EffectSlotMap.lock);
+ UnlockUIntMapRead(&Context->EffectSlotMap);
UnlockContext(Context);
}
@@ -636,7 +636,7 @@ AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void)
ALsizei pos;
LockContext(Context);
- ReadLock(&Context->SourceMap.lock);
+ LockUIntMapRead(&Context->SourceMap);
for(pos = 0;pos < Context->SourceMap.size;pos++)
{
ALsource *Source = Context->SourceMap.array[pos].value;
@@ -649,7 +649,7 @@ AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void)
if(new_state)
SetSourceState(Source, Context, new_state);
}
- ReadUnlock(&Context->SourceMap.lock);
+ UnlockUIntMapRead(&Context->SourceMap);
UnlockContext(Context);
}