aboutsummaryrefslogtreecommitdiffstats
path: root/common/rwlock.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-13 20:26:32 -0800
committerChris Robinson <[email protected]>2018-11-13 20:26:32 -0800
commita5f68c21214e6f85ade835cd29045026797ac2a4 (patch)
tree3b995975906303cfc42b8dc3054f3bbed632dbbb /common/rwlock.h
parent5867c7b8c213aa47659e7c6e6cafddc643d9ea76 (diff)
Avoid using ATOMIC_FLAG
Although it cant potentially be better than a regular atomic, it presents compatibility issues when non-C11 atomics are mixed with C++
Diffstat (limited to 'common/rwlock.h')
-rw-r--r--common/rwlock.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/rwlock.h b/common/rwlock.h
index 8e36fa1a..fee1b070 100644
--- a/common/rwlock.h
+++ b/common/rwlock.h
@@ -11,12 +11,13 @@ extern "C" {
typedef struct {
RefCount read_count;
RefCount write_count;
- ATOMIC_FLAG read_lock;
- ATOMIC_FLAG read_entry_lock;
- ATOMIC_FLAG write_lock;
+ ATOMIC(int) read_lock;
+ ATOMIC(int) read_entry_lock;
+ ATOMIC(int) write_lock;
} RWLock;
#define RWLOCK_STATIC_INITIALIZE { ATOMIC_INIT_STATIC(0), ATOMIC_INIT_STATIC(0), \
- ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT }
+ ATOMIC_INIT_STATIC(0), ATOMIC_INIT_STATIC(0), \
+ ATOMIC_INIT_STATIC(0) }
void RWLockInit(RWLock *lock);
void ReadLock(RWLock *lock);