diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-09-16 19:07:32 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-09-16 19:08:06 -0700 |
commit | 95ba2c2257e56e80fe01cfcce5b533e4b4e54e7b (patch) | |
tree | ed72d6cba0928163786e59d75c3520cb6bb8b4a2 /lib/thread | |
parent | d3091cbc968337bdd47efe3bab7e752972cad726 (diff) | |
download | mc-95ba2c2257e56e80fe01cfcce5b533e4b4e54e7b.tar.gz |
Unbreak mutex.
Diffstat (limited to 'lib/thread')
-rw-r--r-- | lib/thread/mutex+linux.myr | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/thread/mutex+linux.myr b/lib/thread/mutex+linux.myr index 71c7301..61350b8 100644 --- a/lib/thread/mutex+linux.myr +++ b/lib/thread/mutex+linux.myr @@ -63,7 +63,9 @@ const mtxunlock = {mtx are uncontended by the xchg() call, then it's safe to simply return; nobody was waiting for us. */ - if mtx._state != Contended && xchg(&mtx._state, Unlocked) == Locked + if mtx._state == Contended + mtx._state = Unlocked + elif xchg(&mtx._state, Unlocked) == Locked -> ;; @@ -74,7 +76,6 @@ const mtxunlock = {mtx so that if there are still waiters, the thread that took the lock takes responsibility for unlocking. */ - mtx._state = Unlocked for var i = 0; i < nspin; i++ if mtx._state != Unlocked /* |