From d78426257aaf18fcf8b1a957a3f8b712c34d18cb Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 19 Apr 2010 14:17:17 +0000 Subject: [PATCH] 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 --- src/system/libroot/posix/pthread/pthread_spinlock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/posix/pthread/pthread_spinlock.c b/src/system/libroot/posix/pthread/pthread_spinlock.c index d9881feb7a..0814061a4c 100644 --- a/src/system/libroot/posix/pthread/pthread_spinlock.c +++ b/src/system/libroot/posix/pthread/pthread_spinlock.c @@ -5,6 +5,9 @@ #include + +#include + #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; }