From a1ea4c0638ecf4ef3c421b03089000aca7d0f0eb Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 14 Feb 2003 01:12:02 +0000 Subject: 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. --- nptl/tst-cond7.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'nptl/tst-cond7.c') 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"); -- cgit 1.4.1