X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_spin_lock.c;h=ded2b653c4751db88f288af6b84f92a7341263b3;hb=85050ac5a2677a8ebf2722e93b5c037ec675c036;hp=9e43f47539d6dad5661936900ffb20e0c9c36b50;hpb=c322fe4e1a9bcc20f7a2ded1ac0e1674ea282bc0;p=musl diff --git a/src/thread/pthread_spin_lock.c b/src/thread/pthread_spin_lock.c index 9e43f475..ded2b653 100644 --- a/src/thread/pthread_spin_lock.c +++ b/src/thread/pthread_spin_lock.c @@ -1,7 +1,8 @@ #include "pthread_impl.h" +#include int pthread_spin_lock(pthread_spinlock_t *s) { - while (*s || a_xchg(s, 1)); + while (*(volatile int *)s || a_cas(s, 0, EBUSY)) a_spin(); return 0; }