X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_spin_trylock.c;h=5284fdac24d4ae70eb06242131dff16a33c61d90;hb=6aeb9c6703670649ee09b3c8575fb428168bb75c;hp=1fc5f73c174ec890da1457bb8bd776f9e1fb3bc2;hpb=b8b85a42729dc96e43d51848823fbe28ad92b5c0;p=musl diff --git a/src/thread/pthread_spin_trylock.c b/src/thread/pthread_spin_trylock.c index 1fc5f73c..5284fdac 100644 --- a/src/thread/pthread_spin_trylock.c +++ b/src/thread/pthread_spin_trylock.c @@ -1,7 +1,7 @@ #include "pthread_impl.h" +#include int pthread_spin_trylock(pthread_spinlock_t *s) { - if (*s || a_xchg(s, 1)) return EBUSY; - return 0; + return a_cas(s, 0, EBUSY); }