diff --git a/fork.php b/fork.php index 3d48089..50bc6c1 100644 --- a/fork.php +++ b/fork.php @@ -113,6 +113,18 @@ class fork } } + /** Clean the childs which are finished. Do not block the process + */ + public function cleanEndChild () + { + $stoppedPid = pcntl_wait ($status, WNOHANG); + while ($stoppedPid > 0) + { + unset ($this->pidList[$stoppedPid]); + $stoppedPid = pcntl_wait ($status, WNOHANG); + } + } + /** Stop (SIGTERM) a specific child. * If the $maxWait parameter is set, wait the dead of the child for $maxWait * seconds. If $maxWait is not set, do not wait the child, only send it the