diff options
-rw-r--r-- | Alc/helpers.c | 15 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 1 | ||||
-rw-r--r-- | OpenAL32/alThunk.c | 6 |
3 files changed, 12 insertions, 10 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c index 989602f7..f6c05a47 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -277,6 +277,15 @@ static void Unlock(volatile ALenum *l) ExchangeInt(l, AL_FALSE); } +void RWLockInit(RWLock *lock) +{ + lock->read_count = 0; + lock->write_count = 0; + lock->read_lock = AL_FALSE; + lock->read_entry_lock = AL_FALSE; + lock->write_lock = AL_FALSE; +} + void ReadLock(RWLock *lock) { Lock(&lock->read_entry_lock); @@ -314,11 +323,7 @@ void InitUIntMap(UIntMap *map, ALsizei limit) map->size = 0; map->maxsize = 0; map->limit = limit; - map->lock.read_count = 0; - map->lock.write_count = 0; - map->lock.read_lock = AL_FALSE; - map->lock.read_entry_lock = AL_FALSE; - map->lock.write_lock = AL_FALSE; + RWLockInit(&map->lock); } void ResetUIntMap(UIntMap *map) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 1e4d3d61..564730c4 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -321,6 +321,7 @@ typedef struct { volatile ALenum write_lock; } RWLock; +void RWLockInit(RWLock *lock); void ReadLock(RWLock *lock); void ReadUnlock(RWLock *lock); void WriteLock(RWLock *lock); diff --git a/OpenAL32/alThunk.c b/OpenAL32/alThunk.c index 5784a358..7cd83c23 100644 --- a/OpenAL32/alThunk.c +++ b/OpenAL32/alThunk.c @@ -32,11 +32,7 @@ static RWLock ThunkLock; void ThunkInit(void) { - ThunkLock.read_count = 0; - ThunkLock.write_count = 0; - ThunkLock.read_lock = AL_FALSE; - ThunkLock.read_entry_lock = AL_FALSE; - ThunkLock.write_lock = AL_FALSE; + RWLockInit(&ThunkLock); ThunkArraySize = 1; ThunkArray = calloc(1, ThunkArraySize * sizeof(*ThunkArray)); } |