about summary refs log tree commit diff
path: root/nptl/pthread_mutex_timedlock.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-11-01 19:51:41 +0000
committerUlrich Drepper <drepper@redhat.com>2008-11-01 19:51:41 +0000
commitefac1fce6212f0e471ce7fa2519b1d3a4a084ddc (patch)
treebe8d1940955413cdb3bef2fb7e54c58191b398f9 /nptl/pthread_mutex_timedlock.c
parent64647f9aa8727fdcb4c58c7542beca3732148d0a (diff)
downloadglibc-efac1fce6212f0e471ce7fa2519b1d3a4a084ddc.tar.gz
glibc-efac1fce6212f0e471ce7fa2519b1d3a4a084ddc.tar.xz
glibc-efac1fce6212f0e471ce7fa2519b1d3a4a084ddc.zip
[BZ #6955]
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>.
Diffstat (limited to 'nptl/pthread_mutex_timedlock.c')
-rw-r--r--nptl/pthread_mutex_timedlock.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 4bf0efea34..8d0db79d58 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -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;