CAS expected should not be _Atomic type, #1317

This commit is contained in:
Cloud Wu
2021-01-11 17:10:26 +08:00
parent 1ed4fdf94d
commit bc2fba560f
3 changed files with 6 additions and 9 deletions

View File

@@ -31,8 +31,7 @@ rwlock_rlock(struct rwlock *lock) {
static inline void
rwlock_wlock(struct rwlock *lock) {
ATOM_INT clear;
ATOM_INIT(&clear, 0);
int clear = 0;
while (!ATOM_CAS(&lock->write,clear,1)) {}
while(ATOM_LOAD(&lock->read)) {}
}