LibC: Use `pause` in pthread spinlock locking
This commit is contained in:
parent
5e4e174d61
commit
f9451915b9
|
@ -648,7 +648,11 @@ int pthread_spin_lock(pthread_spinlock_t* lock)
|
|||
|
||||
pthread_t expected = 0;
|
||||
while (!BAN::atomic_compare_exchange(*lock, expected, tid, BAN::MemoryOrder::memory_order_acquire))
|
||||
{
|
||||
__builtin_ia32_pause();
|
||||
expected = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue