minor optimization to pthread_spin_trylock
[oweals/musl.git] / src / thread / pthread_spin_trylock.c
index 59de695ddad9ebb4ad941574681829513fe321db..5284fdac24d4ae70eb06242131dff16a33c61d90 100644 (file)
@@ -1,6 +1,7 @@
 #include "pthread_impl.h"
+#include <errno.h>
 
 int pthread_spin_trylock(pthread_spinlock_t *s)
 {
-       return -a_swap(s, 1) & EBUSY;
+       return a_cas(s, 0, EBUSY);
 }