summaryrefslogtreecommitdiff
path: root/nptl/tst-cond7.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-14 01:12:02 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-14 01:12:02 +0000
commita1ea4c0638ecf4ef3c421b03089000aca7d0f0eb (patch)
tree6ecd88fb4921750225d856d4f425b81e06986d3f /nptl/tst-cond7.c
parente8cda341a4e8893a5932a0d22440e7c191c37564 (diff)
Update.
* tst-cond7.c (do_test): Unlock the mutex before canceling the thread. * sysdeps/pthread/pthread.h: Add missing initializers. Protect non-standard initializers with __USE_GNU.
Diffstat (limited to 'nptl/tst-cond7.c')
-rw-r--r--nptl/tst-cond7.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/nptl/tst-cond7.c b/nptl/tst-cond7.c
index 4cc7cfbecc..5ab7b8f8f9 100644
--- a/nptl/tst-cond7.c
+++ b/nptl/tst-cond7.c
@@ -43,6 +43,13 @@ tf (void *arg)
{
puts ("child created");
+ if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0
+ || pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0)
+ {
+ puts ("cannot set cancellation options");
+ exit (1);
+ }
+
T *t = (T *) arg;
if (pthread_mutex_lock (&t->lock) != 0)
@@ -121,6 +128,13 @@ do_test (void)
}
while (! done);
+ /* Release the lock since the cancel handler will get it. */
+ if (pthread_mutex_unlock (&t[i]->lock) != 0)
+ {
+ puts ("mutex_unlock failed");
+ exit (1);
+ }
+
if (pthread_cancel (t[i]->h) != 0)
{
puts ("cancel failed");