mirror of
https://github.com/fluencelabs/musl
synced 2025-06-27 21:52:02 +00:00
revert some more spin optimizations that turned out to be pessimizations
This commit is contained in:
@ -13,7 +13,7 @@ void __lockfile(FILE *f)
|
|||||||
f->lockcount++;
|
f->lockcount++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (f->lock || a_cas(&f->lock, 0, tid))
|
while (a_cas(&f->lock, 0, tid))
|
||||||
if (spins) spins--, a_spin();
|
if (spins) spins--, a_spin();
|
||||||
else syscall(SYS_sched_yield);
|
else syscall(SYS_sched_yield);
|
||||||
f->lockcount = 1;
|
f->lockcount = 1;
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
int pthread_spin_lock(pthread_spinlock_t *s)
|
int pthread_spin_lock(pthread_spinlock_t *s)
|
||||||
{
|
{
|
||||||
while (a_xchg(s, 1));
|
while (a_xchg(s, 1)) a_spin();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,5 @@
|
|||||||
|
|
||||||
int pthread_spin_trylock(pthread_spinlock_t *s)
|
int pthread_spin_trylock(pthread_spinlock_t *s)
|
||||||
{
|
{
|
||||||
if (*s || a_xchg(s, 1)) return EBUSY;
|
return -a_xchg(s, 1) & EBUSY;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user