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:34:09 UTC

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

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



##########
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:
       Hmm... but group_kill_children() calls task_delete():
   
        84           /* 'pid' could refer to the main task of the thread.  That pid
        85            * will appear in the group member list as well!
        86            */
        87
        88           if ((rtcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
        89             {
        90               ret = pthread_cancel(pid);
        91             }
        92           else
        93             {
        94               ret = task_delete(pid);
        95             }
   
   Is that okay?




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