no1wudi commented on a change in pull request #5543:
URL: https://github.com/apache/incubator-nuttx/pull/5543#discussion_r810426239
##########
File path: libs/libc/pthread/pthread_exit.c
##########
@@ -54,6 +54,15 @@
void pthread_exit(FAR void *exit_value)
{
+ /* Mark the pthread as non-cancelable to avoid additional calls to
+ * pthread_exit() due to any cancellation point logic that might get
+ * kicked off by actions taken during pthread_exit processing.
+ */
+
+#ifdef CONFIG_CANCELLATION_POINTS
+ task_setcancelstate(TASK_CANCEL_DISABLE, NULL);
Review comment:
Keep them is not harmful, but there are two case to call the
`pthread_exit`:
1. Application call `pthread_exit` directly, we can mark pthread as
non-cancelable since we are already exiting, as line63 does
2. `pthread_exit` called by cancellation point, if happend, the cpcount must
be 0 and we do the same logic as case 1 immediate, means the state had been set
during `nx_pthread_exit`, no need to set it again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]