mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-24 13:52:53 +02:00
Add rwlockInit (#155)
This commit is contained in:
parent
3513c91c3c
commit
377683acd5
@ -14,6 +14,12 @@ typedef struct {
|
|||||||
u64 b;
|
u64 b;
|
||||||
} RwLock;
|
} 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.
|
* @brief Locks the read/write lock for reading.
|
||||||
* @param r Read/write lock object.
|
* @param r Read/write lock object.
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
#include "kernel/mutex.h"
|
#include "kernel/mutex.h"
|
||||||
#include "kernel/rwlock.h"
|
#include "kernel/rwlock.h"
|
||||||
|
|
||||||
|
void rwlockInit(RwLock* r) {
|
||||||
|
rmutexInit(&r->r);
|
||||||
|
rmutexInit(&r->g);
|
||||||
|
r->b = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void rwlockReadLock(RwLock* r) {
|
void rwlockReadLock(RwLock* r) {
|
||||||
rmutexLock(&r->r);
|
rmutexLock(&r->r);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user