fix rwlock not initializing

This commit is contained in:
Juan Antonio Hernández Cánovas 2018-08-24 15:34:57 +02:00
parent 3513c91c3c
commit d5b13aac3b
2 changed files with 12 additions and 0 deletions

View File

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

View File

@ -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->b);
rmutexInit(r->g);
r->b = 0;
}
void rwlockReadLock(RwLock* r) { void rwlockReadLock(RwLock* r) {
rmutexLock(&r->r); rmutexLock(&r->r);