diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-04-18 11:37:38 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-04-18 11:37:38 -0600 |
commit | af96e09bdcca07703bd943239dde87b6ced1ce83 (patch) | |
tree | 2cbf8a4729e59d2b159eb931ca921bda1208002f /apps/examples/ostest | |
parent | 6892553ef8c7a9a70083830baf65d33cfbd3e81d (diff) | |
download | nuttx-af96e09bdcca07703bd943239dde87b6ced1ce83.tar.gz nuttx-af96e09bdcca07703bd943239dde87b6ced1ce83.tar.bz2 nuttx-af96e09bdcca07703bd943239dde87b6ced1ce83.zip |
Cancel test needs to wait for the thread to set non-cancelable mode at one point
Diffstat (limited to 'apps/examples/ostest')
-rw-r--r-- | apps/examples/ostest/cancel.c | 12 |
1 files changed, 11 insertions, 1 deletions
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 } |