diff --git a/nx/include/switch/kernel/rwlock.h b/nx/include/switch/kernel/rwlock.h index eb70b43d..de594b81 100644 --- a/nx/include/switch/kernel/rwlock.h +++ b/nx/include/switch/kernel/rwlock.h @@ -14,6 +14,12 @@ typedef struct { u64 b; } RwLock; +/** + * @brief Initializes the read/write lock. + * @param r Read/write lock object. + */ +void rwlockInit(RwLock* r); + /** * @brief Locks the read/write lock for reading. * @param r Read/write lock object. diff --git a/nx/source/kernel/rwlock.c b/nx/source/kernel/rwlock.c index e0863716..962dd0ca 100644 --- a/nx/source/kernel/rwlock.c +++ b/nx/source/kernel/rwlock.c @@ -2,6 +2,12 @@ #include "kernel/mutex.h" #include "kernel/rwlock.h" +void rwlockInit(RwLock* r) { + rmutexInit(&r->r); + rmutexInit(&r->g); + r->b = 0; +} + void rwlockReadLock(RwLock* r) { rmutexLock(&r->r);