From dd747573191938c9721945ac455d325d39d64fd2 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 31 Aug 2011 01:00:19 -0700 Subject: Add a function to initialize a RWLock --- Alc/helpers.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Alc/helpers.c') 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) -- cgit v1.2.3