aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/mutex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util/mutex.c b/src/util/mutex.c
index 86ffcf5..98dc849 100644
--- a/src/util/mutex.c
+++ b/src/util/mutex.c
@@ -1,8 +1,10 @@
#include "../util/mutex.h"
+#include "../cpu/atomic/swap.a.h"
unsigned char lock_mutex(struct Mutex* m, unsigned long pid) {
if (m->pid == NULL_PID) {
- m->pid = pid;
+ //m->pid = pid;
+ atm_lock(pid, &m->pid);
return 0;
}
return 1;
@@ -13,7 +15,8 @@ unsigned char lock_mutex(struct Mutex* m, unsigned long pid) {
// mutex's pid lock
unsigned char release_mutex(struct Mutex* m, unsigned long pid) {
if (m->pid == pid) {
- m->pid = NULL_PID;
+ //m->pid = NULL_PID;
+ atm_release(&m->pid);
return 0;
}
return 1;