diff options
author | Chris Robinson <[email protected]> | 2014-07-26 03:00:49 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-07-26 03:00:49 -0700 |
commit | 531c0d8e6b3d0ad8ff4ad8278a1030785deb3d77 (patch) | |
tree | d0d7085526edb0f31bf4986cbc4dd64d0f5ceee8 /common | |
parent | a3dbe08c8b9df301dded52ad78f655c2753be56c (diff) |
Explicitly pass the address of atomics and parameters that can be modified
Diffstat (limited to 'common')
-rw-r--r-- | common/rwlock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/rwlock.c b/common/rwlock.c index 0b185c9b..d7a813df 100644 --- a/common/rwlock.c +++ b/common/rwlock.c @@ -11,19 +11,19 @@ /* A simple spinlock. Yield the thread while the given integer is set by * another. Could probably be improved... */ #define LOCK(l) do { \ - while(ATOMIC_EXCHANGE(int, (l), true) == true) \ + while(ATOMIC_EXCHANGE(int, &(l), true) == true) \ althrd_yield(); \ } while(0) -#define UNLOCK(l) ATOMIC_STORE(l, false) +#define UNLOCK(l) ATOMIC_STORE(&(l), false) void RWLockInit(RWLock *lock) { InitRef(&lock->read_count, 0); InitRef(&lock->write_count, 0); - ATOMIC_STORE_UNSAFE(lock->read_lock, false); - ATOMIC_STORE_UNSAFE(lock->read_entry_lock, false); - ATOMIC_STORE_UNSAFE(lock->write_lock, false); + ATOMIC_STORE_UNSAFE(&lock->read_lock, false); + ATOMIC_STORE_UNSAFE(&lock->read_entry_lock, false); + ATOMIC_STORE_UNSAFE(&lock->write_lock, false); } void ReadLock(RWLock *lock) |