Home » Developing U++ » U++ Developers corner » TheIDE zombie problem
|
Re: TheIDE zombie problem [message #7454 is a reply to message #7453] |
Sat, 30 December 2006 11:04   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
Well, you can start children you don't need to wait on, if you really do not need to know when they die. Just start a new process group (setsid()) before calling.
if (!fork()) {
// as child
close(fileno(STDIN));
close(fileno(STDOUT));
close(fileno(STDERR));
setsid();
execve(argv[0], argv, env);
/* not reached */
}
Iwould assume that's fine for "execute", but if you want to run it in debugged, you may need/want the SIGCHLD to know when it dies? Or if you are using stdin/out, deal/ignore SIGPIPE.
I can certainly fix it, so it leaves no zombies, if that is all that is needed.
|
|
|
|
Re: TheIDE zombie problem [message #7456 is a reply to message #7454] |
Sat, 30 December 2006 11:56   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
lundman wrote on Sat, 30 December 2006 05:04 | Well, you can start children you don't need to wait on, if you really do not need to know when they die. Just start a new process group (setsid()) before calling.
if (!fork()) {
// as child
close(fileno(STDIN));
close(fileno(STDOUT));
close(fileno(STDERR));
setsid();
execve(argv[0], argv, env);
/* not reached */
}
Iwould assume that's fine for "execute", but if you want to run it in debugged, you may need/want the SIGCHLD to know when it dies? Or if you are using stdin/out, deal/ignore SIGPIPE.
I can certainly fix it, so it leaves no zombies, if that is all that is needed.
|
Well I am afraid that above solution is not correct - you have to wait for pid returned from fork in the parent process.
Mirek
|
|
|
|
|
Goto Forum:
Current Time: Mon Apr 28 02:16:14 CEST 2025
Total time taken to generate the page: 0.00479 seconds
|