[PATCH] Fix tst-cond22.c
Jakub Jelinek
jakub@redhat.com
Mon Sep 11 07:32:00 GMT 2006
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
More information about the Libc-hacker
mailing list