You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/18 16:01:13 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5543: sched: Mark pthread as non-cancelable to avoid additional calls to pthread_exit()

xiaoxiang781216 commented on a change in pull request #5543:
URL: https://github.com/apache/incubator-nuttx/pull/5543#discussion_r810132271



##########
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:
       One more point: if we move TASK_CANCEL_DISABLE to nx_pthread_exit, the callback from pthread_cleanup_popall at line 67 may trigger the recursive pthread_exit call which we want to avoid in this patch.




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org