Re: How to automatically kill all children threads when the main thread die

2023-01-16 Thread Xiang Xiao
no, we can iterate all processes through proc/xxx and call getppid to decide whether to kill it. On Mon, Jan 16, 2023 at 9:48 PM Gregory Nutt wrote: > > But nuttx doesn't support task sesion/group yet, so the simple > solution is extend kill command instead. > > Wouldn't you have to introduce a

Re: How to automatically kill all children threads when the main thread die

2023-01-16 Thread Gregory Nutt
> But nuttx doesn't support task sesion/group yet, so the simple solution is extend kill command instead. Wouldn't you have to introduce a non-standard interface behavior to that? I would think you would want to avoid that. > In fact, I was citing threads, but all children were tasks created

Re: How to automatically kill all children threads when the main thread die

2023-01-16 Thread Alan C. Assis
Thank you Greg and Xiang Xiao, In fact, I was citing threads, but all children were tasks created this way: ret = task_create("child1_daemon", 100, 4096, child1_daemon, NULL); I will change it to pthread and I think it will work with those suggestions you guys gave me. BR, Alan On 1/16/23, Xi

Re: How to automatically kill all children threads when the main thread die

2023-01-15 Thread Xiang Xiao
> supported AFAIK. > > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for > Windows > > > > *From: *Xiang Xiao > *Sent: *Sunday, January 15, 2023 9:54 PM > *To: *dev@nuttx.apache.org > *Subject: *Re: How to automatically kill all children t

Re: How to automatically kill all children threads when the main thread die

2023-01-15 Thread Gregory Nutt
//go.microsoft.com/fwlink/?LinkId=550986> for > Windows > > > > *From: *Xiang Xiao > *Sent: *Sunday, January 15, 2023 9:54 PM > *To: *dev@nuttx.apache.org > *Subject: *Re: How to automatically kill all children threads when the > main thread die > > > > If

RE: How to automatically kill all children threads when the main thread die

2023-01-15 Thread Gregory Nutt
m/fwlink/?LinkId=550986> for Windows *From: *Xiang Xiao *Sent: *Sunday, January 15, 2023 9:54 PM *To: *dev@nuttx.apache.org *Subject: *Re: How to automatically kill all children threads when the main thread die If CONFIG_SIG_DEFAULT, the kernel will terminate all child pthreads, but not chil

Re: How to automatically kill all children threads when the main thread die

2023-01-15 Thread Xiang Xiao
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 wrote: >

Re: How to automatically kill all children threads when the main thread die

2023-01-15 Thread Gregory Nutt
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 t

Re: How to automatically kill all children threads when the main thread die

2023-01-15 Thread Gregory Nutt
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. In Linux, you can use the kill command to signal an entire process group, but that the last time I looked, there was no support for process groups in N

Re: How to automatically kill all children threads when the main thread die

2023-01-15 Thread Gregory Nutt
Xaio Xiang problem will know the current behavior better then me, But I think you need: only pthread support. See use of HAVE_GROUP_MEMERS in sched/task/exit.c. see include/nuttx/sched.h for definition of HAVE_GROUP_MEMBERS. (seems to depend only on phtreads). On Sun, Jan 15, 2023 at 5:25 PM A

How to automatically kill all children threads when the main thread die

2023-01-15 Thread Alan C. Assis
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 TYPENPX STATEEVENT SIGMASK STACK COMMAND ... 2727 100 RR