Cancel test needs to wait for the thread to set non-cancelable mode at one point

This commit is contained in:
Gregory Nutt 2013-04-18 11:37:38 -06:00
parent 541d625482
commit 86052985d9

View file

@ -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
}