summaryrefslogtreecommitdiff
path: root/src/thread/pthread_spin_trylock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/pthread_spin_trylock.c')
-rw-r--r--src/thread/pthread_spin_trylock.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/thread/pthread_spin_trylock.c b/src/thread/pthread_spin_trylock.c
index 1fc5f73c..c12696b3 100644
--- a/src/thread/pthread_spin_trylock.c
+++ b/src/thread/pthread_spin_trylock.c
@@ -2,6 +2,5 @@
int pthread_spin_trylock(pthread_spinlock_t *s)
{
- if (*s || a_xchg(s, 1)) return EBUSY;
- return 0;
+ return -a_xchg(s, 1) & EBUSY;
}