* Minor coding style cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36439 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-04-23 18:28:45 +00:00
parent 574e5742ad
commit fd722a6734

View File

@ -18,7 +18,7 @@
int int
pthread_spin_init(pthread_spinlock_t* lock, int pshared) pthread_spin_init(pthread_spinlock_t* lock, int pshared)
{ {
// this implementation of spinlocks doesn't differentiate // This implementation of spinlocks doesn't differentiate
// between spin locks used by threads in the same process or // between spin locks used by threads in the same process or
// between threads of different processes. // between threads of different processes.
@ -37,9 +37,11 @@ pthread_spin_destroy(pthread_spinlock_t* lock)
int 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) {
SPINLOCK_PAUSE(); // spin SPINLOCK_PAUSE(); // spin
// TODO: On UP machines we should thread_yield() in the loop. // TODO: On UP machines we should thread_yield() in the loop.
}
return 0; return 0;
} }