fork : allow to clean without blocking
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4010 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
12
fork.php
12
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.
|
/** Stop (SIGTERM) a specific child.
|
||||||
* If the $maxWait parameter is set, wait the dead of the child for $maxWait
|
* 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
|
* seconds. If $maxWait is not set, do not wait the child, only send it the
|
||||||
|
|||||||
Reference in New Issue
Block a user