From: Ulrich Drepper Date: Mon, 27 Jul 2009 20:46:56 +0000 (-0700) Subject: pthread_mutex_unlock needs to use _rel semantics for atomic ops. X-Git-Tag: fedora/glibc-2.10.90-10~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e73e694e38b7b222eec3ec5897eb507d88bb8928;p=thirdparty%2Fglibc.git pthread_mutex_unlock needs to use _rel semantics for atomic ops. --- diff --git a/nptl/ChangeLog b/nptl/ChangeLog index cb9ec53cd1b..8dd93732b5f 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2009-07-27 Ulrich Drepper + + [BZ #10418] + * pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Use _rel + instead of of _acq variants of cmpxchg. + 2009-07-23 Ulrich Drepper * sysdeps/x86_64/configure.in: New file. diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c index 0028c5583f2..fbe8274a559 100644 --- a/nptl/pthread_mutex_unlock.c +++ b/nptl/pthread_mutex_unlock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2005-2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005-2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -213,7 +213,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr) /* Unlock. */ if ((mutex->__data.__lock & FUTEX_WAITERS) != 0 - || atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock, 0, + || atomic_compare_and_exchange_bool_rel (&mutex->__data.__lock, 0, THREAD_GETMEM (THREAD_SELF, tid))) { @@ -263,7 +263,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr) oldval = mutex->__data.__lock; newval = oldval & PTHREAD_MUTEX_PRIO_CEILING_MASK; } - while (atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock, + while (atomic_compare_and_exchange_bool_rel (&mutex->__data.__lock, newval, oldval)); if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)