summaryrefslogtreecommitdiff
path: root/kern/mutex_i.h
diff options
context:
space:
mode:
Diffstat (limited to 'kern/mutex_i.h')
-rw-r--r--kern/mutex_i.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/kern/mutex_i.h b/kern/mutex_i.h
index 158d8f7f..69131cf8 100644
--- a/kern/mutex_i.h
+++ b/kern/mutex_i.h
@@ -21,8 +21,8 @@
#ifndef X15_MUTEX_PI
#include <kern/assert.h>
+#include <kern/atomic.h>
#include <kern/mutex_types.h>
-#include <machine/atomic.h>
#define MUTEX_UNLOCKED 0
#define MUTEX_LOCKED 1
@@ -31,7 +31,7 @@
static inline unsigned int
mutex_tryacquire(struct mutex *mutex)
{
- return atomic_cas_uint(&mutex->state, MUTEX_UNLOCKED, MUTEX_LOCKED);
+ return atomic_cas_seq_cst(&mutex->state, MUTEX_UNLOCKED, MUTEX_LOCKED);
}
static inline unsigned int
@@ -39,7 +39,7 @@ mutex_release(struct mutex *mutex)
{
unsigned int state;
- state = atomic_swap_uint(&mutex->state, MUTEX_UNLOCKED);
+ state = atomic_swap_seq_cst(&mutex->state, MUTEX_UNLOCKED);
assert((state == MUTEX_LOCKED) || (state == MUTEX_CONTENDED));
return state;
}