diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-03-28 04:25:17 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-03-28 04:25:17 +0000 |
commit | 0f6699ea0554a667de301d46fcfe1baf0d53d094 (patch) | |
tree | c9360cea0ccc7c79d4235f43a661f51ffda5492f /nptl/pthread_mutex_init.c | |
parent | 5b20043897accf32d33ae775af7413098cd0cec2 (diff) | |
download | glibc-0f6699ea0554a667de301d46fcfe1baf0d53d094.tar.gz glibc-0f6699ea0554a667de301d46fcfe1baf0d53d094.tar.xz glibc-0f6699ea0554a667de301d46fcfe1baf0d53d094.zip |
* sysdeps/unix/sysv/linux/kernel-features.h: Add
__ASSUME_SET_ROBUST_LIST.
Diffstat (limited to 'nptl/pthread_mutex_init.c')
-rw-r--r-- | nptl/pthread_mutex_init.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c index f984d90ae4..c25e4035e5 100644 --- a/nptl/pthread_mutex_init.c +++ b/nptl/pthread_mutex_init.c @@ -22,7 +22,6 @@ #include <string.h> #include "pthreadP.h" - static const struct pthread_mutexattr default_attr = { /* Default is a normal mutex, not shared between processes. */ @@ -42,10 +41,6 @@ __pthread_mutex_init (mutex, mutexattr) imutexattr = (const struct pthread_mutexattr *) mutexattr ?: &default_attr; /* Sanity checks. */ - // XXX For now we cannot implement robust mutexes if they are shared. - if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0 - && (imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0) - return ENOTSUP; // XXX For now we don't support priority inherited or priority protected // XXX mutexes. if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK) @@ -57,8 +52,18 @@ __pthread_mutex_init (mutex, mutexattr) /* Copy the values from the attribute. */ mutex->__data.__kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS; + if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0) - mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_PRIVATE_NP; + { +#ifndef __ASSUME_SET_ROBUST_LIST + if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0 + && __set_robust_list_avail < 0) + return ENOTSUP; +#endif + + mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP; + } + switch ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK) >> PTHREAD_MUTEXATTR_PROTOCOL_SHIFT) { |