examples/ostest: Works around a bug in printf() when cancellation points are enabled. printf() is a cancellation point because it calls write(). This is correct according to OpenGroup.org. However, printf holds the stdio library semaphore when it is canceled and this leaves the semaphore in a bad state. No fix for the printf bug yet.

This commit is contained in:
Gregory Nutt 2017-10-10 14:01:26 -06:00
parent ae41122371
commit 73c10a2607

View File

@ -137,6 +137,12 @@ static FAR void *thread_waiter(FAR void *parameter)
printf("thread_waiter: ERROR pthread_cond_wait returned after being cancelled!\n");
}
/* Why is this here? Because pthread_setcancelstate() is not a
* cancellation point but printf() is.
*/
pthread_testcancel();
printf("thread_waiter: Exit with status 0x12345678\n");
pthread_exit((pthread_addr_t)0x12345678);
return NULL;