Add rwlockInit (#155)

This commit is contained in:
Juan Antonio Hernández Cánovas 2018-08-24 16:20:01 +02:00 committed by fincs
parent 3513c91c3c
commit 377683acd5
2 changed files with 12 additions and 0 deletions

View File

@ -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.

View File

@ -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);