You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/10/19 13:32:37 UTC

[incubator-nuttx] 01/02: sched.h: Simplify HAVE_GROUP_MEMBERS logic

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

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

commit 8a972817e0e4c541f720eeb994a498ae2a659352
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Oct 18 14:27:28 2022 +0900

    sched.h: Simplify HAVE_GROUP_MEMBERS logic
    
    After the retirement of CONFIG_SCHED_EXIT_KILL_CHILDREN, [1]
    the behavior is now effectively controlled by
    CONFIG_SCHED_CHILD_STATUS, which is IMO confusing.
    (It was even surprising me.)
    
    This commit solves it by making HAVE_GROUP_MEMBERS
    a synonym of !CONFIG_DISABLE_PTHREAD. I guess this change aligns
    the intention of the CONFIG_SCHED_EXIT_KILL_CHILDREN retirement.
    That is, always tries to be similar to the standard behavior.
    
    Another option would be to revive CONFIG_SCHED_EXIT_KILL_CHILDREN
    and make the HAVE_GROUP_MEMBERS logic aware of it.
    It might be a good idea if we want a finer-grained control of
    code to build. (One can argue his application uses pthread
    but does never _exit. In that case, it might be a waste to maintain
    group membership. I suspect it might not be too rare in embedded
    world.)
    
    [1] commit 6982eb35feb2daba8a55d7f89c716c28aaf126e0
---
 include/nuttx/sched.h | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index 88680f71ae..c22785b245 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -51,24 +51,17 @@
 
 /* Configuration ************************************************************/
 
-/* Task groups currently only supported for retention of child status */
-
-#undef HAVE_GROUP_MEMBERS
-
-/* We need a group an group members if we are supporting the parent/child
- * relationship.
+/* We need to track group members at least for:
+ *
+ * - To signal all tasks in a group. (eg. SIGCHLD)
+ * - _exit() to collect siblings threads.
  */
 
-#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS)
+#undef HAVE_GROUP_MEMBERS
+#if !defined(CONFIG_DISABLE_PTHREAD)
 #  define HAVE_GROUP_MEMBERS  1
 #endif
 
-/* We don't need group members if support for pthreads is disabled */
-
-#ifdef CONFIG_DISABLE_PTHREAD
-#  undef HAVE_GROUP_MEMBERS
-#endif
-
 /* Sporadic scheduling */
 
 #ifndef CONFIG_SCHED_SPORADIC_MAXREPL