From 4eb984d3ab5641ce7992204756ac15a61f5f7181 Mon Sep 17 00:00:00 2001 From: Torvald Riegel Date: Tue, 23 Jun 2015 15:22:25 +0200 Subject: Clean up BUSY_WAIT_NOP and atomic_delay. This patch combines BUSY_WAIT_NOP and atomic_delay into a new atomic_spin_nop function and adjusts all clients. The new function is put into atomic.h because what is best done in a spin loop is architecture-specific, and atomics must be used for spinning. The function name is meant to tell users that this has no effect on synchronization semantics but is a performance aid for spinning. --- nptl/pthread_mutex_lock.c | 6 ++---- nptl/pthread_mutex_timedlock.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'nptl') diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c index 96075129b8..9a3b46624d 100644 --- a/nptl/pthread_mutex_lock.c +++ b/nptl/pthread_mutex_lock.c @@ -23,6 +23,7 @@ #include #include #include "pthreadP.h" +#include #include #include @@ -135,10 +136,7 @@ __pthread_mutex_lock (mutex) LLL_MUTEX_LOCK (mutex); break; } - -#ifdef BUSY_WAIT_NOP - BUSY_WAIT_NOP; -#endif + atomic_spin_nop (); } while (LLL_MUTEX_TRYLOCK (mutex) != 0); diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c index 109a46a84d..f0fb03e90b 100644 --- a/nptl/pthread_mutex_timedlock.c +++ b/nptl/pthread_mutex_timedlock.c @@ -22,6 +22,7 @@ #include #include #include "pthreadP.h" +#include #include #include @@ -125,10 +126,7 @@ pthread_mutex_timedlock (mutex, abstime) PTHREAD_MUTEX_PSHARED (mutex)); break; } - -#ifdef BUSY_WAIT_NOP - BUSY_WAIT_NOP; -#endif + atomic_spin_nop (); } while (lll_trylock (mutex->__data.__lock) != 0); -- cgit v1.2.3