]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[BZ #6955]
authorUlrich Drepper <drepper@redhat.com>
Sat, 1 Nov 2008 19:51:41 +0000 (19:51 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 1 Nov 2008 19:51:41 +0000 (19:51 +0000)
2008-11-01  Ulrich Drepper  <drepper@redhat.com>
[BZ #6955]
* pthread_mutex_lock.c: Add support for private PI mutexes.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
Patch mostly by Ben Jackson <ben@ben.com>.

nptl/ChangeLog
nptl/pthread_mutex_lock.c
nptl/pthread_mutex_timedlock.c
nptl/pthread_mutex_trylock.c
nptl/pthread_mutex_unlock.c

index df01334d15fe66ff9811d5734bc83c8d0097d75e..bc87e2b4d7e0538c51a58af5aecd18453f556308 100644 (file)
@@ -1,3 +1,12 @@
+2008-11-01  Ulrich Drepper  <drepper@redhat.com>
+
+       [BZ #6955]
+       * pthread_mutex_lock.c: Add support for private PI mutexes.
+       * pthread_mutex_timedlock.c: Likewise.
+       * pthread_mutex_trylock.c: Likewise.
+       * pthread_mutex_unlock.c: Likewise.
+       Patch mostly by Ben Jackson <ben@ben.com>.
+
 2008-10-31  Ulrich Drepper  <drepper@redhat.com>
 
        [BZ #6843]
index ed98dfc6c39e689b78ae438a1102847d964ee33c..3eb5636955b8a35d8bc36bc3c39b463e811ed861 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -269,9 +269,13 @@ __pthread_mutex_lock (mutex)
          {
            /* The mutex is locked.  The kernel will now take care of
               everything.  */
+           int private = (robust
+                          ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+                          : PTHREAD_MUTEX_PSHARED (mutex));
            INTERNAL_SYSCALL_DECL (__err);
            int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-                                     FUTEX_LOCK_PI, 1, 0);
+                                     __lll_private_flag (FUTEX_LOCK_PI,
+                                                         private), 1, 0);
 
            if (INTERNAL_SYSCALL_ERROR_P (e, __err)
                && (INTERNAL_SYSCALL_ERRNO (e, __err) == ESRCH
@@ -327,7 +331,10 @@ __pthread_mutex_lock (mutex)
 
            INTERNAL_SYSCALL_DECL (__err);
            INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-                             FUTEX_UNLOCK_PI, 0, 0);
+                             __lll_private_flag (FUTEX_UNLOCK_PI,
+                                                 PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+),
+                             0, 0);
 
            THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
            return ENOTRECOVERABLE;
index 4bf0efea34a6664090fd6aeda7f3aae7c7272081..8d0db79d58e6c71e87c3093867f24c4502525f3c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -254,10 +254,15 @@ pthread_mutex_timedlock (mutex, abstime)
            /* The mutex is locked.  The kernel will now take care of
               everything.  The timeout value must be a relative value.
               Convert it.  */
+           int private = (robust
+                          ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+                          : PTHREAD_MUTEX_PSHARED (mutex));
            INTERNAL_SYSCALL_DECL (__err);
 
            int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-                                     FUTEX_LOCK_PI, 1, abstime);
+                                     __lll_private_flag (FUTEX_LOCK_PI,
+                                                         private), 1,
+                                     abstime);
            if (INTERNAL_SYSCALL_ERROR_P (e, __err))
              {
                if (INTERNAL_SYSCALL_ERRNO (e, __err) == ETIMEDOUT)
@@ -331,7 +336,9 @@ pthread_mutex_timedlock (mutex, abstime)
 
            INTERNAL_SYSCALL_DECL (__err);
            INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-                             FUTEX_UNLOCK_PI, 0, 0);
+                             __lll_private_flag (FUTEX_UNLOCK_PI,
+                                                 PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
+                             0, 0);
 
            THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
            return ENOTRECOVERABLE;
index f6e24d413893c3d5a255f97d0b3db69ee37f5be7..25029bedce7c6d43671a199cf52ebe1f7cc971bd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -231,9 +231,13 @@ __pthread_mutex_trylock (mutex)
 
            /* The mutex owner died.  The kernel will now take care of
               everything.  */
+           int private = (robust
+                          ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+                          : PTHREAD_MUTEX_PSHARED (mutex));
            INTERNAL_SYSCALL_DECL (__err);
            int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-                                     FUTEX_TRYLOCK_PI, 0, 0);
+                                     __lll_private_flag (FUTEX_TRYLOCK_PI,
+                                                         private), 0, 0);
 
            if (INTERNAL_SYSCALL_ERROR_P (e, __err)
                && INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK)
@@ -274,7 +278,9 @@ __pthread_mutex_trylock (mutex)
 
            INTERNAL_SYSCALL_DECL (__err);
            INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-                             FUTEX_UNLOCK_PI, 0, 0);
+                             __lll_private_flag (FUTEX_UNLOCK_PI,
+                                                 PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
+                             0, 0);
 
            THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
            return ENOTRECOVERABLE;
index d33d0593d8d9c441435aebcdb441b67bde7f4d0b..a14c43ece7b4dd33e325a9537024550e97b2ce2e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -196,9 +196,13 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
                                                   THREAD_GETMEM (THREAD_SELF,
                                                                  tid)))
        {
+         int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP;
+         int private = (robust
+                        ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+                        : PTHREAD_MUTEX_PSHARED (mutex));
          INTERNAL_SYSCALL_DECL (__err);
          INTERNAL_SYSCALL (futex, __err, 2, &mutex->__data.__lock,
-                           FUTEX_UNLOCK_PI);
+                           __lll_private_flag (FUTEX_UNLOCK_PI, private));
        }
 
       THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);