2014-04-07 15:52:06 +02:00
|
|
|
[PATCH] Properly handle forced elision in pthread_mutex_trylock
|
|
|
|
|
|
|
|
BZ #16657
|
2014-09-15 12:37:45 +02:00
|
|
|
* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
|
2014-04-07 15:52:06 +02:00
|
|
|
FORCE_ELISION instead of DO_ELISION.
|
|
|
|
* sysdeps/unix/sysv/linux/x86/force-elision.h (DO_ELISION):
|
|
|
|
Remove.
|
|
|
|
|
2014-09-15 12:37:45 +02:00
|
|
|
Index: glibc-2.19.90/nptl/pthread_mutex_trylock.c
|
2014-04-07 15:52:06 +02:00
|
|
|
===================================================================
|
2014-09-15 12:37:45 +02:00
|
|
|
--- glibc-2.19.90.orig/nptl/pthread_mutex_trylock.c
|
|
|
|
+++ glibc-2.19.90/nptl/pthread_mutex_trylock.c
|
2014-04-07 15:52:06 +02:00
|
|
|
@@ -26,8 +26,8 @@
|
|
|
|
#define lll_trylock_elision(a,t) lll_trylock(a)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
-#ifndef DO_ELISION
|
|
|
|
-#define DO_ELISION(m) 0
|
|
|
|
+#ifndef FORCE_ELISION
|
|
|
|
+#define FORCE_ELISION(m, s)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* We don't force elision in trylock, because this can lead to inconsistent
|
|
|
|
@@ -77,8 +77,7 @@ __pthread_mutex_trylock (mutex)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case PTHREAD_MUTEX_TIMED_NP:
|
|
|
|
- if (DO_ELISION (mutex))
|
|
|
|
- goto elision;
|
|
|
|
+ FORCE_ELISION (mutex, goto elision);
|
|
|
|
/*FALL THROUGH*/
|
|
|
|
case PTHREAD_MUTEX_ADAPTIVE_NP:
|
|
|
|
case PTHREAD_MUTEX_ERRORCHECK_NP:
|
2014-09-15 12:37:45 +02:00
|
|
|
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/x86/force-elision.h
|
2014-04-07 15:52:06 +02:00
|
|
|
===================================================================
|
2014-09-15 12:37:45 +02:00
|
|
|
--- glibc-2.19.90.orig/sysdeps/unix/sysv/linux/x86/force-elision.h
|
|
|
|
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/x86/force-elision.h
|
2014-04-07 15:52:06 +02:00
|
|
|
@@ -16,11 +16,6 @@
|
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
-/* Check for elision on this lock without upgrading. */
|
|
|
|
-#define DO_ELISION(m) \
|
|
|
|
- (__pthread_force_elision \
|
|
|
|
- && (m->__data.__kind & PTHREAD_MUTEX_NO_ELISION_NP) == 0) \
|
|
|
|
-
|
|
|
|
/* Automatically enable elision for existing user lock kinds. */
|
|
|
|
#define FORCE_ELISION(m, s) \
|
|
|
|
if (__pthread_force_elision \
|