nuttx/sched/group
ligd 1552e52e14 signal: fix group signal can't dispatch some parent group twice
reproduce:

static void *pthread(void *arg)
{
  system(arg);
}

void test (int argc, char *argv[])
{
  pthread_create(&pthread0, &attr, pthread, argv[1]);
  pthread_create(&pthread1, &attr, pthread, argv[2]);
}

only one pthread system() returnd, othres hanged

rootcause:

As we known, system() will create a new task called:
system -c XX

The example:
parent group               child groups

pthread0 -> waitpid() -> system -c ps -> exit() -> nxtask_signalparent()
pthread1 -> waitpid() -> system -c ls -> exit() -> nxtask_signalparent()

Each child group exit with function nxtask_signalparent(),

As we expect:

system -c ps will signal pthread0
system -c ls will signal pthread1

But actually:

system -c ps will signal pthread0/1
system -c ls will signal pthread0/1

As the spec, we know, this behavior is normal:
https://man7.org/linux/man-pages/man2/sigwaitinfo.2.html

So for this situation, when the signo is SIGCHLD, we broadcast.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 03:35:59 -07:00
..
CMakeLists.txt cmake: fix CMake build break 2023-07-15 23:32:36 +08:00
group_argvstr.c sched/addrenv.c: Implement re-entrancy for addrenv_select() 2023-04-25 14:33:19 +02:00
group_childstatus.c
group_continue.c
group_create.c
group_exitinfo.c
group_find.c
group_foreachchild.c
group_free.c
group_getgid.c
group_getuid.c
group_join.c sched/group: Ensure that the setting of tg_members if safe in SMP 2023-06-15 22:24:00 +08:00
group_killchildren.c nuttx: add more dependent header file 2023-04-11 09:13:32 +03:00
group_leave.c
group_malloc.c
group_realloc.c
group_setgid.c
group_setuid.c
group_setupidlefiles.c
group_setupstreams.c
group_setuptaskfiles.c
group_signal.c signal: fix group signal can't dispatch some parent group twice 2023-08-03 03:35:59 -07:00
group_suspendchildren.c
group_waiter.c
group_zalloc.c
group.h
Make.defs group/tg_info/argv: Make utility function to read argv as string 2023-02-17 01:27:16 +08:00