diff options
Diffstat (limited to 'nptl/tst-cond7.c')
-rw-r--r-- | nptl/tst-cond7.c | 14 |
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"); |