mirror of
https://github.com/fluencelabs/musl
synced 2025-06-25 12:42:02 +00:00
optimize spin lock not to dirty cache line while spinning
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user