LibC: Use `pause` in pthread spinlock locking

This commit is contained in:
Bananymous 2025-06-16 15:07:58 +03:00
parent 5e4e174d61
commit f9451915b9
1 changed files with 4 additions and 0 deletions

View File

@ -648,7 +648,11 @@ int pthread_spin_lock(pthread_spinlock_t* lock)
pthread_t expected = 0; pthread_t expected = 0;
while (!BAN::atomic_compare_exchange(*lock, expected, tid, BAN::MemoryOrder::memory_order_acquire)) while (!BAN::atomic_compare_exchange(*lock, expected, tid, BAN::MemoryOrder::memory_order_acquire))
{
__builtin_ia32_pause();
expected = 0; expected = 0;
}
return 0; return 0;
} }