mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
optimize spin lock not to dirty cache line while spinning
This commit is contained in:
parent
b8dda24fe1
commit
7b1fb0c526
1 changed files with 1 additions and 1 deletions
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
int pthread_spin_lock(pthread_spinlock_t *s)
|
int pthread_spin_lock(pthread_spinlock_t *s)
|
||||||
{
|
{
|
||||||
while (a_swap(s, 1)) a_spin();
|
while (*(volatile int *)s || a_cas(s, 0, 1)) a_spin();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue