summaryrefslogtreecommitdiff
path: root/src/kernel/lib/sched.h
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-18 11:25:25 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-18 11:25:25 +0200
commitf3e03796652b792bb3fd5d3d25b687b9a7f14633 (patch)
treefeef62986de699702136aaf0d56295fde9297115 /src/kernel/lib/sched.h
parentc19415d2ffb6f063f91983ff505e2530ab500908 (diff)
downloadTCE-f3e03796652b792bb3fd5d3d25b687b9a7f14633.tar.gz
TCE-f3e03796652b792bb3fd5d3d25b687b9a7f14633.zip
A bit of a change in the directory layout.
Diffstat (limited to 'src/kernel/lib/sched.h')
-rw-r--r--src/kernel/lib/sched.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/kernel/lib/sched.h b/src/kernel/lib/sched.h
new file mode 100644
index 0000000..1fe148d
--- /dev/null
+++ b/src/kernel/lib/sched.h
@@ -0,0 +1,24 @@
+#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
+typedef uint32_t mutex_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int mutex_lock(mutex_t* mutex); //wait for mutex to be free
+int mutex_lockE(mutex_t* mutex); //lock mutex only if free, returns !0 if locked, 0 if was busy
+void mutex_unlock(mutex_t* mutex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif