mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
optimize contended case for pthread_spin_trylock
This commit is contained in:
parent
c322fe4e1a
commit
b8b85a4272
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue