summaryrefslogtreecommitdiff
path: root/src/include/mutex.h
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-03-31 17:26:21 +0200
committerAlexis211 <alexis211@gmail.com>2010-03-31 17:26:21 +0200
commitb945eafa126d6a17aa8826a405df7d5d4d999008 (patch)
tree34b5ba6f0c13b1b35770375f51183a047271a4d4 /src/include/mutex.h
parentad1ec29070e1ffba7461687cd268e64be06aa78b (diff)
downloadTCE-b945eafa126d6a17aa8826a405df7d5d4d999008.tar.gz
TCE-b945eafa126d6a17aa8826a405df7d5d4d999008.zip
Shared memory segment manager in userland
Diffstat (limited to 'src/include/mutex.h')
-rw-r--r--src/include/mutex.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/mutex.h b/src/include/mutex.h
new file mode 100644
index 0000000..50b5606
--- /dev/null
+++ b/src/include/mutex.h
@@ -0,0 +1,15 @@
+#ifndef DEF_MUTEX_H
+#define DEF_MUTEX_H
+
+#include <gc/syscall.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