EvChild::__construct
(PECL ev >= 0.2.0)
EvChild::__construct — Constructs the EvChild watcher object
Description
$pid
,
bool
$trace
,
callable
$callback
[,
mixed
$data
= NULL
[,
int
$priority
= 0
]] )Constructs the EvChild watcher object.
Call the callback when a status change for process ID
pid
(or any
PID
if
pid
is
0
) has been received(a status change happens when the process terminates or
is killed, or, when
trace
is TRUE
, additionally when it is stopped or continued). In other words,
when the process receives a
SIGCHLD
,
Ev
will fetch the outstanding exit/wait status for all changed/zombie children
and call the callback.
It is valid to install a child watcher after an EvChild has exited but before the event loop has started its next iteration. For example, first one calls fork , then the new child process might exit, and only then an EvChild watcher is installed in the parent for the new PID .
You can access both exit/tracing status and
pid
by using the
rstatus
and
rpid
properties of the watcher object.
The number of PID watchers per PID is unlimited. All of them will be called.
The EvChild::createStopped() method doesn't start(activate) the newly created watcher.
Parameters
-
pid
-
Wait for status changes of process PID(or any process if PID is specified as
0
). -
trace
-
If
FALSE
, only activate the watcher when the process terminates. Otherwise(TRUE
) additionally activate the watcher when the process is stopped or continued. -
callback
-
See Watcher callbacks .
-
data
-
Custom data associated with the watcher.
-
priority
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-evchild.construct.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.