X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_spin_trylock.c;h=c12696b3010b332706d203faa7e16cad62433bca;hp=1fc5f73c174ec890da1457bb8bd776f9e1fb3bc2;hb=6232b96f5153d0b718054a8bc569fcd7d596bab2;hpb=b8b85a42729dc96e43d51848823fbe28ad92b5c0 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; }