You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/06/15 13:17:50 UTC

[incubator-nuttx] branch master updated: sched: Remove SCHED_EXIT_KILL_CHILDREN option

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 6982eb3  sched: Remove SCHED_EXIT_KILL_CHILDREN option
6982eb3 is described below

commit 6982eb35feb2daba8a55d7f89c716c28aaf126e0
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jun 11 10:29:21 2020 +0800

    sched: Remove SCHED_EXIT_KILL_CHILDREN option
    
    All standard indicate exit should terminate the whole process/task:
    https://pubs.opengroup.org/onlinepubs/007904975/functions/exit.html
    https://en.cppreference.com/w/c/program/exit
    https://linux.die.net/man/2/exit
    so let's remove the option and trust the caller know the difference:
    1.exit terminate all threads belong the current process/task
    2.pthread_exit only terminate the current(main/pthread) thread
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: I2950ddee3d471272bb9570782f1cd4af33513d57
---
 sched/Kconfig     | 12 ------------
 sched/task/exit.c |  2 +-
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/sched/Kconfig b/sched/Kconfig
index 931e233..f7fe1ef 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -616,18 +616,6 @@ config SCHED_WAITPID
 		compliant) and will enable the waitid() and wait() interfaces as
 		well.
 
-config SCHED_EXIT_KILL_CHILDREN
-	bool "Enable kill all children when exit"
-	default n
-	depends on SCHED_HAVE_PARENT && SCHED_CHILD_STATUS
-	---help---
-		When a task exits, all of its child threads will be killed.
-
-		Caution:  This selection should not be used unless you are certain
-		of what you are doing.  Uninformed of this option can often lead to
-		memory leaks since, for example, memory allocations held by threads
-		are not automatically freed!
-
 config SCHED_USER_IDENTITY
 	bool "Support per-task User Identity"
 	default n
diff --git a/sched/task/exit.c b/sched/task/exit.c
index fed287a..102ddaa 100644
--- a/sched/task/exit.c
+++ b/sched/task/exit.c
@@ -78,7 +78,7 @@ void exit(int status)
 
   status &= 0xff;
 
-#ifdef CONFIG_SCHED_EXIT_KILL_CHILDREN
+#ifdef HAVE_GROUP_MEMBERS
   /* Kill all of the children of the group, preserving only this thread.
    * exit() is normally called from the main thread of the task.  pthreads
    * exit through a different mechanism.