summaryrefslogtreecommitdiff
path: root/src/kernel/lib/mutex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/lib/mutex.h')
-rw-r--r--src/kernel/lib/mutex.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/kernel/lib/mutex.h b/src/kernel/lib/mutex.h
new file mode 100644
index 0000000..2687b30
--- /dev/null
+++ b/src/kernel/lib/mutex.h
@@ -0,0 +1,15 @@
+#ifndef DEF_MUTEX_H
+#define DEF_MUTEX_H
+
+#include <types.h>
+
+#define MUTEX_LOCKED 1
+#define MUTEX_UNLOCKED 0
+
+//A mutex is just an uint32_t
+
+void mutex_lock(uint32_t* mutex); //wait for mutex to be free
+int mutex_lockE(uint32_t* mutex); //lock mutex only if free, returns !0 if locked, 0 if was busy
+void mutex_unlock(uint32_t* mutex);
+
+#endif