mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 06:58:22 +00:00
kernel: mutexes
This commit is contained in:
@@ -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
|
||||||
Reference in New Issue
Block a user