mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-31 23:11:09 +00:00
Disable elision for any pthread_mutexattr_settype call
PTHREAD_MUTEX_NORMAL requires deadlock for nesting, DEFAULT does not. Since glibc uses the same value (0) disable elision for any call to pthread_mutexattr_settype() with a 0 value. This implies that a program can disable elision by doing pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL) Based on a original proposal by Rich Felker.
This commit is contained in:
parent
e8c659d74e
commit
49186d21ef
@ -1,3 +1,8 @@
|
||||
2013-07-02 Andi Kleen <ak@linux.intel.com>
|
||||
|
||||
* pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
|
||||
Disable elision for PTHREAD_MUTEX_DEFAULT.
|
||||
|
||||
2013-07-02 Andi Kleen <ak@linux.intel.com>
|
||||
Hongjiu Lu <hongjiu.lu@intel.com>
|
||||
|
||||
|
@ -30,6 +30,11 @@ __pthread_mutexattr_settype (attr, kind)
|
||||
if (kind < PTHREAD_MUTEX_NORMAL || kind > PTHREAD_MUTEX_ADAPTIVE_NP)
|
||||
return EINVAL;
|
||||
|
||||
/* Cannot distinguish between DEFAULT and NORMAL. So any settype
|
||||
call disables elision for now. */
|
||||
if (kind == PTHREAD_MUTEX_DEFAULT)
|
||||
kind |= PTHREAD_MUTEX_NO_ELISION_NP;
|
||||
|
||||
iattr = (struct pthread_mutexattr *) attr;
|
||||
|
||||
iattr->mutexkind = (iattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_BITS) | kind;
|
||||
|
Loading…
Reference in New Issue
Block a user