Skip to content

Commit

Permalink
pthread_mutex_unlock needs to use _rel semantics for atomic ops.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Jul 27, 2009
1 parent 052757b commit e73e694
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2009-07-27 Ulrich Drepper <drepper@redhat.com>

[BZ #10418]
* pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Use _rel
instead of of _acq variants of cmpxchg.

2009-07-23 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/configure.in: New file.
Expand Down
6 changes: 3 additions & 3 deletions nptl/pthread_mutex_unlock.c
Original file line number Diff line number Diff line change
@@ -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 <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -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)))
{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e73e694

Please sign in to comment.