kernel: mutexes

This commit is contained in:
Matheus
2023-05-04 22:46:31 -03:00
parent 26e9f370b5
commit 0840a0c8f1
+20
View File
@@ -0,0 +1,20 @@
#ifndef _MUTEX_H
#define _MUTEX_H
#include <semaphore.h>
typedef semaphore_t mutex_t;
#define MUTEX_INIT(m) \
SEMAPHORE_INIT(m, 1);
#define MUTEX_ACQUIRE(m, i) \
semaphore_wait(m, i)
#define MUTEX_RELEASE(m) \
semaphore_signal(m)
#define MUTEX_TRY(m) \
semaphore_test(m)
#endif