diff options
author | Chris Robinson <[email protected]> | 2011-08-31 01:00:19 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-31 01:00:19 -0700 |
commit | dd747573191938c9721945ac455d325d39d64fd2 (patch) | |
tree | 7cc22884334ae00dc1a5f2256b8dbcfe4618a1f6 /Alc/helpers.c | |
parent | ab0b5d98902665603384f7744dd759cd33db007f (diff) |
Add a function to initialize a RWLock
Diffstat (limited to 'Alc/helpers.c')
-rw-r--r-- | Alc/helpers.c | 15 |
1 files changed, 10 insertions, 5 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) |