You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
2.0 KiB
56 lines
2.0 KiB
commit b0a3c1640ab2fb7d16d9b9a8d9c0e524e9cb0001 |
|
Author: Andreas Schwab <schwab@suse.de> |
|
Date: Tue Mar 4 13:00:26 2014 +0100 |
|
|
|
Properly handle forced elision in pthread_mutex_trylock (bug 16657) |
|
|
|
Index: glibc-2.17-c758a686/nptl/pthread_mutex_trylock.c |
|
=================================================================== |
|
--- glibc-2.17-c758a686.orig/nptl/pthread_mutex_trylock.c |
|
+++ glibc-2.17-c758a686/nptl/pthread_mutex_trylock.c |
|
@@ -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 |
|
@@ -69,7 +69,7 @@ __pthread_mutex_trylock (mutex) |
|
break; |
|
|
|
case PTHREAD_MUTEX_TIMED_ELISION_NP: |
|
- elision: |
|
+ elision: __attribute__((unused)) |
|
if (lll_trylock_elision (mutex->__data.__lock, |
|
mutex->__data.__elision) != 0) |
|
break; |
|
@@ -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: |
|
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h |
|
=================================================================== |
|
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h |
|
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h |
|
@@ -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 \
|
|
|