summaryrefslogtreecommitdiffstats
path: root/firmware/kernel/pthread/mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/kernel/pthread/mutex.c')
-rw-r--r--firmware/kernel/pthread/mutex.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/firmware/kernel/pthread/mutex.c b/firmware/kernel/pthread/mutex.c
new file mode 100644
index 0000000000..49503b5d82
--- /dev/null
+++ b/firmware/kernel/pthread/mutex.c
@@ -0,0 +1,21 @@
+#include <pthread.h>
+#include "kernel.h"
+
+void mutex_init(struct mutex *m)
+{
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&m->mutex, &attr);
+ pthread_mutexattr_destroy(&attr);
+}
+
+void mutex_lock(struct mutex *m)
+{
+ pthread_mutex_lock(&m->mutex);
+}
+
+void mutex_unlock(struct mutex *m)
+{
+ pthread_mutex_unlock(&m->mutex);
+}