<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.evchild.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'evchild.construct.php',
    1 => 'EvChild::__construct',
    2 => 'Constructs the EvChild watcher object',
  ),
  'up' => 
  array (
    0 => 'class.evchild.php',
    1 => 'EvChild',
  ),
  'prev' => 
  array (
    0 => 'class.evchild.php',
    1 => 'EvChild',
  ),
  'next' => 
  array (
    0 => 'evchild.createstopped.php',
    1 => 'EvChild::createStopped',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ev/evchild/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="evchild.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">EvChild::__construct</h1>
  <p class="verinfo">(PECL ev &gt;= 0.2.0)</p><p class="refpurpose"><span class="refname">EvChild::__construct</span> &mdash; <span class="dc-title">Constructs the EvChild watcher object</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-evchild.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><strong>EvChild::__construct</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$pid</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$trace</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$data</code>
    <span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$priority</code>
    <span class="initializer"> = 0</span>
   </span><br>)</div>

  <p class="simpara">
   Constructs the
   <span class="classname"><a href="class.evchild.php" class="classname">EvChild</a></span>
   watcher object.
  </p>
  <p class="simpara">
   Call the callback when a status change for process ID
   <code class="parameter">pid</code>
   (or any
   <em>PID</em>
   if
   <code class="parameter">pid</code>
   is
   <code class="literal">0</code>)
   has been received(a status change happens when the process terminates or
   is killed, or, when
   <code class="parameter">trace</code>
   is <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, additionally when it is stopped or continued). In other words,
   when the process receives a
   <strong><code><a href="pcntl.constants.php#constant.sigchld">SIGCHLD</a></code></strong>,
   <em>Ev</em>
   will fetch the outstanding exit/wait status for all changed/zombie children
   and call the callback.
  </p>
  <p class="simpara">
   It is valid to install a child watcher after an
   <span class="classname"><a href="class.evchild.php" class="classname">EvChild</a></span>
   has exited but before the event loop has started its next iteration. For
   example, first one calls
   <code class="literal">fork</code>,
   then the new child process might exit, and only then an
   <span class="classname"><a href="class.evchild.php" class="classname">EvChild</a></span>
   watcher is installed in the parent for the new
   <em>PID</em>.
  </p>
  <p class="simpara">
   You can access both exit/tracing status and
   <code class="parameter">pid</code>
   by using the
   <var class="varname">rstatus</var>
   and
   <var class="varname">rpid</var>
   properties of the watcher object.
  </p>
  <p class="simpara">
   The number of
   <em>PID</em>
   watchers per
   <em>PID</em>
   is unlimited. All of them will be called.
  </p>
  <p class="simpara">
   The
   <span class="methodname"><a href="evchild.createstopped.php" class="methodname">EvChild::createStopped()</a></span>
   method doesn&#039;t start(activate) the newly created watcher.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-evchild.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
     <code class="parameter">pid</code>
    </dt>
    <dd>
     <span class="simpara">
      Wait for status changes of process PID(or any process if PID is
      specified as
      <code class="literal">0</code>
      ).
     </span>
    </dd>
   
   
    <dt>
     <code class="parameter">trace</code>
    </dt>
    <dd>
     <span class="simpara">
      If <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, only activate the watcher when the process terminates.
      Otherwise(<strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>) additionally activate the watcher when the process is
      stopped or continued.
     </span>
    </dd>
   
   
    <dt>
     <code class="parameter">callback</code>
    </dt>
    <dd>
     <span class="simpara">
      See
      <a href="ev.watcher-callbacks.php" class="link">Watcher callbacks</a>.
     </span>
    </dd>
   
   
    <dt>
     <code class="parameter">data</code>
    </dt>
    <dd>
     <span class="simpara">
      Custom data associated with the watcher.
     </span>
    </dd>
   
   
    <dt>
     <code class="parameter">priority</code>
    </dt>
    <dd>
     <span class="simpara">
      <a href="class.ev.php#ev.constants.watcher-pri" class="link">Watcher priority</a>
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 seealso" id="refsect1-evchild.construct-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li>
    <span class="methodname"><a href="evloop.child.php" class="methodname" rel="rdfs-seeAlso">EvLoop::child()</a> - Creates EvChild object associated with the current event loop</span>
   </li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>