This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix tst-cond22.c


Hi!

tst-cond22.c occassionally fails with
first thread not canceled
cond = { 0, 2, 1, 1, 1, 0x804b140, 0, 0 }
cond = { 0, 4, 2, 2, 2, 0x804b140, 0, 0 }

The problem is that it relies on tf thread not being woken up (with
pthread_signal) before pthread_cancel is run.  If tf is woken before
pthread_cancel is called in the initial thread, then the thread just runs
through until return NULL; and exits.
Alternatively, we could if (res == NULL) just try again a few times and only
give up (with no error) if the "first thread" has not been successfully
cancelled for say 16 or 32 times. 

2006-09-11  Jakub Jelinek  <jakub@redhat.com>

	* tst-cond22.c (do_test): Don't insist the first thread has to be
	cancelled.

--- libc/nptl/tst-cond22.c	2006-09-11 08:56:52.000000000 +0200
+++ libc/nptl/tst-cond22.c	2006-09-11 09:22:03.000000000 +0200
@@ -94,9 +94,9 @@ do_test (void)
       puts ("1st join failed");
       return 1;
     }
-  if (res != PTHREAD_CANCELED)
+  if (res != PTHREAD_CANCELED && res != NULL)
     {
-      puts ("first thread not canceled");
+      puts ("first thread not canceled nor exited successfully");
       status = 1;
     }
 


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]