diff options
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)); |