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 2020/06/10 17:48:02 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1225: task_delete should remove all threads in the task

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



##########
File path: sched/task/task_delete.c
##########
@@ -132,6 +133,26 @@ int task_delete(pid_t pid)
       goto errout;
     }
 
+  /* Check if the task to delete is the calling task */
+
+  if (pid == rtcb->pid)
+    {
+      /* If it is, then what we really wanted to do was exit. Note that we
+       * don't bother to unlock the TCB since it will be going away.
+       */
+
+      exit(EXIT_SUCCESS);
+    }
+
+#ifdef HAVE_GROUP_MEMBERS
+  /* Kill all of the children of the task.  This will not kill the currently
+   * running task/pthread (this_task).  It will kill the main thread of the
+   * task group if this_task is a pthread.
+   */
+
+  group_kill_children(dtcb);

Review comment:
       there is another patch which change the code to:
   ```
   ret = pthread_cancel(pid);
   ```
   Of course, the change only work after we unify the main and pthread difference(e.g. the cleanup stack and robust mutex). I will drop this patch now and resend after the unification patch pass the review.




----------------------------------------------------------------
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.

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