diff options
author | Agustina Arzille <avarzille@riseup.net> | 2017-04-03 16:09:51 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-04-04 22:07:06 +0200 |
commit | b1730c99f882fc2662c6b64371a4b11a8231bb9f (patch) | |
tree | c4fa5fa51287aee6d6cb372f1cfa8f6413ababd6 /kern/rtmutex_i.h | |
parent | d5bb14cf6a8305bda2a5a73ce727e5309996a20a (diff) |
Use the new atomic operations interface
Stick to a sequentially consistent model for most atomic operations as it
matches the semantics of the existing code. Each call site will have to be
reevaluated in order to switch to more relaxed accesses where possible.
Diffstat (limited to 'kern/rtmutex_i.h')
-rw-r--r-- | kern/rtmutex_i.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kern/rtmutex_i.h b/kern/rtmutex_i.h index b99b5bd0..8825b047 100644 --- a/kern/rtmutex_i.h +++ b/kern/rtmutex_i.h @@ -22,9 +22,9 @@ #include <stdint.h> #include <kern/assert.h> +#include <kern/atomic.h> #include <kern/rtmutex_types.h> #include <kern/thread.h> -#include <machine/atomic.h> /* * Real-time mutex flags. @@ -57,7 +57,7 @@ rtmutex_tryacquire(struct rtmutex *rtmutex) owner = (uintptr_t)thread_self(); rtmutex_assert_owner_aligned(owner); - return atomic_cas_uintptr(&rtmutex->owner, 0, owner); + return atomic_cas_seq_cst(&rtmutex->owner, 0, owner); } static inline uintptr_t @@ -67,7 +67,7 @@ rtmutex_tryrelease(struct rtmutex *rtmutex) owner = (uintptr_t)thread_self(); rtmutex_assert_owner_aligned(owner); - prev_owner = atomic_cas_uintptr(&rtmutex->owner, owner, 0); + prev_owner = atomic_cas_seq_cst(&rtmutex->owner, owner, 0); assert((prev_owner & RTMUTEX_OWNER_MASK) == owner); return prev_owner; } |