aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2015-06-23 15:22:25 +0200
committerTorvald Riegel <triegel@redhat.com>2015-06-30 15:57:15 +0200
commit4eb984d3ab5641ce7992204756ac15a61f5f7181 (patch)
tree12603bae9d2582033a3186174d1379121e1ea642 /nptl
parente02920bc029019443326eecaa7b267b78ff2892e (diff)
downloadglibc-4eb984d3ab5641ce7992204756ac15a61f5f7181.zip
glibc-4eb984d3ab5641ce7992204756ac15a61f5f7181.tar.gz
glibc-4eb984d3ab5641ce7992204756ac15a61f5f7181.tar.bz2
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.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/pthread_mutex_lock.c6
-rw-r--r--nptl/pthread_mutex_timedlock.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 9607512..9a3b466 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -23,6 +23,7 @@
#include <sys/param.h>
#include <not-cancel.h>
#include "pthreadP.h"
+#include <atomic.h>
#include <lowlevellock.h>
#include <stap-probe.h>
@@ -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 109a46a..f0fb03e 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -22,6 +22,7 @@
#include <sys/param.h>
#include <sys/time.h>
#include "pthreadP.h"
+#include <atomic.h>
#include <lowlevellock.h>
#include <not-cancel.h>
@@ -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);