Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5088

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Waits on or returns the status of a forked child</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.pcntl-strerror.html">pcntl_strerror</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.pcntl-waitpid.html">pcntl_waitpid</a></div>
 <div class="up"><a href="ref.pcntl.html">PCNTL Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.pcntl-wait" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pcntl_wait</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">pcntl_wait</span> &mdash; <span class="dc-title">Waits on or returns the status of a forked child</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pcntl-wait-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>pcntl_wait</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$status</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   The wait function suspends execution of the current process until a
   child has exited, or until a signal is delivered whose action is to
   terminate the current process or to call a signal handling function.  If a
   child has already exited by the time of the call (a so-called &quot;zombie&quot;
   process), the function returns immediately.  Any system resources used by
   the child are freed.  Please see your system&#039;s wait(2) man page for
   specific details as to how wait works on your system.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function is equivalent to calling  <span class="function"><a href="function.pcntl-waitpid.html" class="function">pcntl_waitpid()</a></span>
    with a <em>-1</em> <em><code class="parameter">pid</code></em> and no
    <em><code class="parameter">options</code></em>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pcntl-wait-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">status</code></em></span>
     <dd>

      <p class="para">
        <span class="function"><strong>pcntl_wait()</strong></span> will store status information
       in the <em><code class="parameter">status</code></em> parameter which can be
       evaluated using the following functions:
        <span class="function"><a href="function.pcntl-wifexited.html" class="function">pcntl_wifexited()</a></span>,
        <span class="function"><a href="function.pcntl-wifstopped.html" class="function">pcntl_wifstopped()</a></span>,
        <span class="function"><a href="function.pcntl-wifsignaled.html" class="function">pcntl_wifsignaled()</a></span>,
        <span class="function"><a href="function.pcntl-wexitstatus.html" class="function">pcntl_wexitstatus()</a></span>,
        <span class="function"><a href="function.pcntl-wtermsig.html" class="function">pcntl_wtermsig()</a></span> and
        <span class="function"><a href="function.pcntl-wstopsig.html" class="function">pcntl_wstopsig()</a></span>.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">options</code></em></span>
     <dd>

      <p class="para">
       If wait3 is available on your system (mostly BSD-style systems), you can
       provide the optional <em><code class="parameter">options</code></em> parameter.  If this
       parameter is not provided, wait will be used for the system call.  If
       wait3 is not available, providing a value for <em><code class="parameter">options
       </code></em> will have no effect. The value of <em><code class="parameter">options
       </code></em> is the value of zero or more of the following two constants
       <em>OR</em>&#039;ed together:
       <table class="doctable table">
        <caption><strong>Possible values for <em><code class="parameter">options</code></em></strong></caption>
        
         <tbody class="tbody">
          <tr>
           <td><em>WNOHANG</em></td>
           <td>
            Return immediately if no child has exited.
           </td>
          </tr>

          <tr>
           <td><em>WUNTRACED</em></td>
           <td>
            Return for children which are stopped, and whose status has
            not been reported.
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pcntl-wait-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
    <span class="function"><strong>pcntl_wait()</strong></span> returns the process ID of the
   child which exited, -1 on error or zero if WNOHANG was provided as an
   option (on wait3-available systems) and no child was available.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pcntl-wait-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.pcntl-fork.html" class="function" rel="rdfs-seeAlso">pcntl_fork()</a> - Forks the currently running process</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-signal.html" class="function" rel="rdfs-seeAlso">pcntl_signal()</a> - Installs a signal handler</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-wifexited.html" class="function" rel="rdfs-seeAlso">pcntl_wifexited()</a> - Checks if status code represents a normal exit</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-wifstopped.html" class="function" rel="rdfs-seeAlso">pcntl_wifstopped()</a> - Checks whether the child process is currently stopped</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-wifsignaled.html" class="function" rel="rdfs-seeAlso">pcntl_wifsignaled()</a> - Checks whether the status code represents a termination due to a signal</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-wexitstatus.html" class="function" rel="rdfs-seeAlso">pcntl_wexitstatus()</a> - Returns the return code of a terminated child</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-wtermsig.html" class="function" rel="rdfs-seeAlso">pcntl_wtermsig()</a> - Returns the signal which caused the child to terminate</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-wstopsig.html" class="function" rel="rdfs-seeAlso">pcntl_wstopsig()</a> - Returns the signal which caused the child to stop</span></li>
    <li class="member"> <span class="function"><a href="function.pcntl-waitpid.html" class="function" rel="rdfs-seeAlso">pcntl_waitpid()</a> - Waits on or returns the status of a forked child</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.pcntl-strerror.html">pcntl_strerror</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.pcntl-waitpid.html">pcntl_waitpid</a></div>
 <div class="up"><a href="ref.pcntl.html">PCNTL Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>