diff options
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r-- | OpenAL32/Include/alMain.h | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index a9f5813d..fd645218 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -161,22 +161,6 @@ typedef ptrdiff_t ALsizeiptrEXT; #endif -typedef struct UIntMap { - struct { - ALuint key; - ALvoid *value; - } *array; - ALsizei size; - ALsizei maxsize; -} UIntMap; - -void InitUIntMap(UIntMap *map); -void ResetUIntMap(UIntMap *map); -ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); -void RemoveUIntMapKey(UIntMap *map, ALuint key); -ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); - - #ifdef _WIN32 #ifndef _WIN32_WINNT @@ -184,8 +168,6 @@ ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); #endif #include <windows.h> -extern UIntMap TlsDestructor; - typedef DWORD pthread_key_t; int pthread_key_create(pthread_key_t *key, void (*callback)(void*)); int pthread_key_delete(pthread_key_t key); @@ -309,6 +291,38 @@ DECL_TEMPLATE(ALenum) #undef DECL_TEMPLATE +typedef struct { + volatile RefCount read_count; + volatile RefCount write_count; + volatile ALenum read_lock; + volatile ALenum read_entry_lock; + volatile ALenum write_lock; +} RWLock; + +void ReadLock(RWLock *lock); +void ReadUnlock(RWLock *lock); +void WriteLock(RWLock *lock); +void WriteUnlock(RWLock *lock); + + +typedef struct UIntMap { + struct { + ALuint key; + ALvoid *value; + } *array; + ALsizei size; + ALsizei maxsize; + RWLock lock; +} UIntMap; +extern UIntMap TlsDestructor; + +void InitUIntMap(UIntMap *map); +void ResetUIntMap(UIntMap *map); +ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); +void RemoveUIntMapKey(UIntMap *map, ALuint key); +ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); + + #include "alListener.h" #include "alu.h" |