optimize contended case for pthread_spin_trylock

This commit is contained in:
Rich Felker 2011-03-24 23:06:08 -04:00
parent c322fe4e1a
commit b8b85a4272

View File

@ -2,5 +2,6 @@
int pthread_spin_trylock(pthread_spinlock_t *s)
{
return -a_xchg(s, 1) & EBUSY;
if (*s || a_xchg(s, 1)) return EBUSY;
return 0;
}