Use SPINLOCK_PAUSE() in the pthread_spin_lock() loop.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36352 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-04-19 14:17:17 +00:00
parent 45b01eb841
commit d78426257a
@@ -5,6 +5,9 @@
#include <pthread.h>
#include <arch_cpu_defs.h>
#include "pthread_private.h"
@@ -35,7 +38,8 @@ int
pthread_spin_lock(pthread_spinlock_t* lock)
{
while (atomic_test_and_set((int32*)&lock->lock, LOCKED, UNLOCKED) == LOCKED)
; // spin
SPINLOCK_PAUSE(); // spin
// TODO: On UP machines we should thread_yield() in the loop.
return 0;
}