diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-07-11 08:13:12 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-07-11 08:13:12 +0000 |
commit | df8843c5a803743714e1b0b53ea8e4e8f8c95f42 (patch) | |
tree | c99ce2859df2a645c744596a999aa870a0490f6d /nptl | |
parent | ac7609f7998add41673e8428cf0bc824a40a1361 (diff) |
Updated to fedora-glibc-20060710T2206cvs/fedora-glibc-2_4_90-13
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 5 | ||||
-rw-r--r-- | nptl/pthread_mutex_init.c | 23 |
2 files changed, 21 insertions, 7 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 985c92d4e1..02b4c2f191 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2006-07-01 Ulrich Drepper <drepper@redhat.com> + + * pthread_mutex_init.c (__pthread_mutex_init): Move some + computations to compile time. + 2006-06-04 Ulrich Drepper <drepper@redhat.com> * sysdeps/pthread/pthread.h: Add pthread_equal inline version. diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c index c25e4035e5..c3f9c2d1c0 100644 --- a/nptl/pthread_mutex_init.c +++ b/nptl/pthread_mutex_init.c @@ -43,9 +43,17 @@ __pthread_mutex_init (mutex, mutexattr) /* Sanity checks. */ // 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; + switch (__builtin_expect (imutexattr->mutexkind + & PTHREAD_MUTEXATTR_PROTOCOL_MASK, + PTHREAD_PRIO_NONE + << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT)) + { + case PTHREAD_PRIO_NONE << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT: + break; + + default: + return ENOTSUP; + } /* Clear the whole variable. */ memset (mutex, '\0', __SIZEOF_PTHREAD_MUTEX_T); @@ -64,13 +72,13 @@ __pthread_mutex_init (mutex, mutexattr) mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP; } - switch ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK) - >> PTHREAD_MUTEXATTR_PROTOCOL_SHIFT) + switch (imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK) { - case PTHREAD_PRIO_INHERIT: + case PTHREAD_PRIO_INHERIT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT: mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_INHERIT_PRIVATE_NP; break; - case PTHREAD_PRIO_PROTECT: + + case PTHREAD_PRIO_PROTECT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT: mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_PROTECT_PRIVATE_NP; if (PTHREAD_MUTEX_PRIO_CEILING_MASK == PTHREAD_MUTEXATTR_PRIO_CEILING_MASK) @@ -82,6 +90,7 @@ __pthread_mutex_init (mutex, mutexattr) >> PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT) << PTHREAD_MUTEX_PRIO_CEILING_SHIFT; break; + default: break; } |