diff options
author | Roland McGrath <roland@gnu.org> | 2006-02-28 09:57:07 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2006-02-28 09:57:07 +0000 |
commit | a5f2bd861c4c84ac66164951a7f32e1d6f57849c (patch) | |
tree | 513c87adf7cf9e919713fc3e0f55959a6b2f6d3b /nptl/pthread_mutex_init.c | |
parent | 8d2e6a0383b6958311f021ee0b8b7eba44110f5a (diff) | |
download | glibc-a5f2bd861c4c84ac66164951a7f32e1d6f57849c.zip glibc-a5f2bd861c4c84ac66164951a7f32e1d6f57849c.tar.gz glibc-a5f2bd861c4c84ac66164951a7f32e1d6f57849c.tar.bz2 |
* elf/rtld-Rules (subdir-args): New variable.
(rtld-subdir-make): Use it.
Diffstat (limited to 'nptl/pthread_mutex_init.c')
-rw-r--r-- | nptl/pthread_mutex_init.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c index 17d1c99..f984d90 100644 --- a/nptl/pthread_mutex_init.c +++ b/nptl/pthread_mutex_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -46,6 +46,11 @@ __pthread_mutex_init (mutex, mutexattr) 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) + != (PTHREAD_PRIO_NONE << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT)) + return ENOTSUP; /* Clear the whole variable. */ memset (mutex, '\0', __SIZEOF_PTHREAD_MUTEX_T); @@ -54,6 +59,27 @@ __pthread_mutex_init (mutex, mutexattr) 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; + switch ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK) + >> PTHREAD_MUTEXATTR_PROTOCOL_SHIFT) + { + case PTHREAD_PRIO_INHERIT: + mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_INHERIT_PRIVATE_NP; + break; + case PTHREAD_PRIO_PROTECT: + mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_PROTECT_PRIVATE_NP; + if (PTHREAD_MUTEX_PRIO_CEILING_MASK + == PTHREAD_MUTEXATTR_PRIO_CEILING_MASK) + mutex->__data.__kind |= (imutexattr->mutexkind + & PTHREAD_MUTEXATTR_PRIO_CEILING_MASK); + else + mutex->__data.__kind |= ((imutexattr->mutexkind + & PTHREAD_MUTEXATTR_PRIO_CEILING_MASK) + >> PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT) + << PTHREAD_MUTEX_PRIO_CEILING_SHIFT; + break; + default: + break; + } /* Default values: mutex not used yet. */ // mutex->__count = 0; already done by memset |