mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-08 22:55:12 +00:00
Cancel test needs to wait for the thread to set non-cancelable mode at one point
This commit is contained in:
parent
541d625482
commit
86052985d9
1 changed files with 11 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue