diff options
author | pixel <pixel> | 2007-12-20 17:07:11 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-12-20 17:07:11 +0000 |
commit | 0dfefdd04e794daa4a163dc791f340467da80df3 (patch) | |
tree | c53d0f92068a1fbdac91d69bf592c700605acbd4 /lib | |
parent | 9d308fa82533e7d9573d7a0d242a4d9dfea1ae78 (diff) |
Trying to add support for better children support - workaround for the late <defunc> bug.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/TaskMan.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 5064048..24bbf77 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: TaskMan.cc,v 1.47 2007-06-25 10:11:28 pixel Exp $ */ +/* $Id: TaskMan.cc,v 1.48 2007-12-20 17:07:11 pixel Exp $ */ #ifndef _WIN32 #include <signal.h> @@ -67,6 +67,22 @@ void taskman_sighup(int sig) { } #endif +void TaskMan::CleanChildren() { +#ifndef _WIN32 + int status; + pid_t pid; + + while (1) { + pid = waitpid(-1, &status, WNOHANG); + if (GotChild(pid, status)) { + got_sigchild++; + } else { + WaitFor(pid, 0, status); + } + } +#endif +} + void TaskMan::SigChild() { int status; pid_t pid; @@ -624,6 +640,7 @@ void TaskMan::MainLoop() throw (GeneralException) { #ifndef _WIN32 sigprocmask(SIG_BLOCK, &sigchildset, 0); #endif + CleanChildren(); if (r < 0) { if (errno != EINTR) { throw GeneralException(String(_("Error during poll: ")) + strerror(errno)); |