rwlock: Review comments

This commit is contained in:
plutooo 2019-03-28 23:17:50 +01:00
parent e48496ccf4
commit e6d03e05f4
2 changed files with 3 additions and 3 deletions

View File

@ -13,8 +13,8 @@ typedef struct {
Mutex mutex;
CondVar condvar_readers;
CondVar condvar_writer;
u64 readers;
bool writer;
u32 readers : 31;
bool writer : 1;
} RwLock;
/**

View File

@ -26,7 +26,7 @@ void rwlockReadLock(RwLock* r) {
void rwlockReadUnlock(RwLock* r) {
mutexLock(&r->mutex);
if (r->readers-- == 1) {
if (--r->readers == 0) {
condvarWakeAll(&r->condvar_readers);
}