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:
@@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include <arch_cpu_defs.h>
|
||||||
|
|
||||||
#include "pthread_private.h"
|
#include "pthread_private.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +38,8 @@ int
|
|||||||
pthread_spin_lock(pthread_spinlock_t* lock)
|
pthread_spin_lock(pthread_spinlock_t* lock)
|
||||||
{
|
{
|
||||||
while (atomic_test_and_set((int32*)&lock->lock, LOCKED, UNLOCKED) == LOCKED)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user