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/mutex.c | |
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/mutex.c')
-rw-r--r-- | kern/mutex.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kern/mutex.c b/kern/mutex.c index 353d94a..00077f2 100644 --- a/kern/mutex.c +++ b/kern/mutex.c @@ -34,7 +34,7 @@ mutex_lock_slow(struct mutex *mutex) sleepq = sleepq_lend(mutex, false, &flags); for (;;) { - state = atomic_swap_uint(&mutex->state, MUTEX_CONTENDED); + state = atomic_swap_seq_cst(&mutex->state, MUTEX_CONTENDED); if (state == MUTEX_UNLOCKED) { break; @@ -44,7 +44,7 @@ mutex_lock_slow(struct mutex *mutex) } if (sleepq_empty(sleepq)) { - state = atomic_swap_uint(&mutex->state, MUTEX_LOCKED); + state = atomic_swap_seq_cst(&mutex->state, MUTEX_LOCKED); assert(state == MUTEX_CONTENDED); } |