about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-09-15 12:51:47 +0000
committerJakub Jelinek <jakub@redhat.com>2006-09-15 12:51:47 +0000
commit5d456f7eba1c5083679973d53ef78b45b22818ca (patch)
treef4be894988fc80cdc48f3ff1a8d4a86d27decb9a /nptl
parenteffe3e2d1a084fde8fae9b91febb28c97781f9e5 (diff)
downloadglibc-5d456f7eba1c5083679973d53ef78b45b22818ca.tar.gz
glibc-5d456f7eba1c5083679973d53ef78b45b22818ca.tar.xz
glibc-5d456f7eba1c5083679973d53ef78b45b22818ca.zip
Updated to fedora-glibc-20060915T0943
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/tst-cond22.c18
2 files changed, 17 insertions, 6 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 159c3bfcf2..afa9a37c97 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* tst-cond22.c (tf): Slight changes to the pthread_cond_wait use
+	to guarantee the thread is always canceled.
+
 2006-09-08  Jakub Jelinek  <jakub@redhat.com>
 
 	* tst-cond22.c: Include pthread.h instead of pthreadP.h.
diff --git a/nptl/tst-cond22.c b/nptl/tst-cond22.c
index 1094c09068..aff38fcc8d 100644
--- a/nptl/tst-cond22.c
+++ b/nptl/tst-cond22.c
@@ -30,11 +30,17 @@ tf (void *arg)
       exit (1);
     }
   pthread_cleanup_push (cl, NULL);
-  if (pthread_cond_wait (&c, &m) != 0)
-    {
-      printf ("%s: cond_wait failed\n", __func__);
-      exit (1);
-    }
+  /* We have to loop here because the cancellation might come after
+     the cond_wait call left the cancelable area and is then waiting
+     on the mutex.  In this case the beginning of the second cond_wait
+     call will cause the cancellation to happen.  */
+  do
+    if (pthread_cond_wait (&c, &m) != 0)
+      {
+	printf ("%s: cond_wait failed\n", __func__);
+	exit (1);
+      }
+  while (arg == NULL);
   pthread_cleanup_pop (0);
   if (pthread_mutex_unlock (&m) != 0)
     {
@@ -105,7 +111,7 @@ do_test (void)
 	  c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex,
 	  c.__data.__nwaiters, c.__data.__broadcast_seq);
 
-  if (pthread_create (&th, NULL, tf, NULL) != 0)
+  if (pthread_create (&th, NULL, tf, (void *) 1l) != 0)
     {
       puts ("2nd create failed");
       return 1;