diff --git a/nx/include/switch/kernel/rwlock.h b/nx/include/switch/kernel/rwlock.h index e100bac4..bf23edaa 100644 --- a/nx/include/switch/kernel/rwlock.h +++ b/nx/include/switch/kernel/rwlock.h @@ -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; /** diff --git a/nx/source/kernel/rwlock.c b/nx/source/kernel/rwlock.c index a39680ef..1da465ad 100644 --- a/nx/source/kernel/rwlock.c +++ b/nx/source/kernel/rwlock.c @@ -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); }