If CONFIG_SIG_DEFAULT, the kernel will terminate all child pthreads, but not child tasks. We can extend kill to support -P flag like pkill: https://linux.die.net/man/1/pkill -P ppid,... Only match processes whose parent process ID is listed.
On Mon, Jan 16, 2023 at 10:14 AM Gregory Nutt <spudan...@gmail.com> wrote: > he > > > Ooops. No, you a re asking about tasks, not threads. That is easier. > > The answer is no: One task exiting has not effect at all any other > tasks. > > > > The question is confusing because it asks about killing other threads (aka > pthreads) when the main (task) exits. But the example shows only tasks > (main threads). > > https://cwiki.apache.org/confluence/display/NUTTX/Tasks+vs.+Threads+FAQ > > > > > >> On Sun, Jan 15, 2023 at 5:25 PM Alan C. Assis <acas...@gmail.com> > wrote: > >> > >>> Dear NuttXers, > >>> > >>> I want to know if there are some hidden configuration that forces all > >>> children to die when the father task die. > >>> > >>> Currently only teh main task dies: > >>> > >>> nsh> family & > >>> > >>> nsh> ps > >>> PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK > >>> COMMAND > >>> ... > >>> 27 27 100 RR Task --- Waiting Signal 00000000 004032 > >>> family > >>> 28 28 100 RR Task --- Waiting Semaphore 00000000 > >>> 004032 child1_daemon > >>> 29 29 100 RR Task --- Waiting Signal 00000000 > >>> 004032 child2_daemon > >>> 30 30 100 RR Task --- Waiting Signal 00000000 > >>> 001984 child3_daemon > >>> > >>> nsh> kill 27 > >>> nsh> ps > >>> PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK > >>> COMMAND > >>> ... > >>> 28 28 100 RR Task --- Waiting Signal 00000000 > >>> 004032 child1_daemon > >>> 29 29 100 RR Task --- Waiting Signal 00000000 > >>> 004032 child2_daemon > >>> 30 30 100 RR Task --- Waiting Signal 00000000 > >>> 001984 child3_daemon > >>> > >>> I could setup a signal handling to handle the kill signal in the main > >>> task and use it to change the value of some conditional variable that > >>> maintain the threads loop of each child running, this is is an option, > >>> but maybe there are better option. > >>> > >>> Please let me know how you are solving this issue. > >>> > >>> BR, > >>> > >>> Alan > >>> > >> >