From af96e09bdcca07703bd943239dde87b6ced1ce83 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 18 Apr 2013 11:37:38 -0600 Subject: Cancel test needs to wait for the thread to set non-cancelable mode at one point --- apps/examples/ostest/cancel.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'apps/examples/ostest') diff --git a/apps/examples/ostest/cancel.c b/apps/examples/ostest/cancel.c index 11981d819..b9085b958 100644 --- a/apps/examples/ostest/cancel.c +++ b/apps/examples/ostest/cancel.c @@ -266,11 +266,21 @@ void cancel_test(void) } /* Test 3: Non-cancelable threads ************************************/ + /* This test currently depends on signals. It doesn't have to and + * could be re-designed so that it does not depend on signals. + */ +#ifndef CONFIG_DISABLE_SIGNALS printf("cancel_test: Test 3: Non-cancelable threads\n"); printf("cancel_test: Re-starting thread (non-cancelable)\n"); restart_thread(&waiter, 0); + /* Give the thread a chance to run an to set the non-cancelable state. + * This is the dependency on signals: + */ + + usleep(200*1000); + /* Then cancel it. It should be in the pthread_cond_wait now. The * behavior here is non-standard: when the thread is at a cancelation * point, it should be cancelable, even when cancelation is disable. @@ -329,5 +339,5 @@ void cancel_test(void) printf("cancel_test: PASS thread terminated with PTHREAD_CANCELED\n"); } } - +#endif } -- cgit v1.2.3