about summary refs log tree commit diff
path: root/nptl/pthread_create.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-12-27 14:48:14 +0000
committerJakub Jelinek <jakub@redhat.com>2005-12-27 14:48:14 +0000
commit64cd3e83c9993f3c1a3c24ea3030a22ccf35e12d (patch)
tree8808fad08bb8677b0e0d2158c65096eae5484767 /nptl/pthread_create.c
parente3173d2c996d8e30dfe44e9bf530881da6df6aaa (diff)
downloadglibc-64cd3e83c9993f3c1a3c24ea3030a22ccf35e12d.tar.gz
glibc-64cd3e83c9993f3c1a3c24ea3030a22ccf35e12d.tar.xz
glibc-64cd3e83c9993f3c1a3c24ea3030a22ccf35e12d.zip
Updated to fedora-glibc-20051227T1426
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r--nptl/pthread_create.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index c11d972572..2dbe58dcd4 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -52,7 +52,7 @@ unsigned int __nptl_nthreads = 1;
 #include "allocatestack.c"
 
 /* Code to create the thread.  */
-#include "createthread.c"
+#include <createthread.c>
 
 
 struct pthread *
@@ -310,6 +310,33 @@ start_thread (void *arg)
      the breakpoint reports TD_THR_RUN state rather than TD_THR_ZOMBIE.  */
   atomic_bit_set (&pd->cancelhandling, EXITING_BIT);
 
+  /* If this thread has any robust mutexes locked, handle them now.  */
+  pthread_mutex_t *robust = THREAD_GETMEM (pd, robust_list);
+  if (__builtin_expect (robust != NULL, 0))
+    {
+      do
+	{
+	  pthread_mutex_t *this = robust;
+	  robust = robust->__data.__next;
+
+	  assert (lll_mutex_islocked (this->__data.__lock));
+	  this->__data.__count = 0;
+	  --this->__data.__nusers;
+	  assert (this->__data.__owner != PTHREAD_MUTEX_NOTRECOVERABLE);
+	  this->__data.__owner = PTHREAD_MUTEX_OWNERDEAD;
+	  this->__data.__next = NULL;
+#ifdef __PTHREAD_MUTEX_HAVE_PREV
+	  this->__data.__prev = NULL;
+#endif
+
+	  lll_mutex_unlock (this->__data.__lock);
+	}
+      while (robust != NULL);
+
+      /* Clean up so that the thread descriptor can be reused.  */
+      THREAD_SETMEM (pd, robust_list, NULL);
+    }
+
   /* If the thread is detached free the TCB.  */
   if (IS_DETACHED (pd))
     /* Free the TCB.  */