Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 3447

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>pcntl_waitpid</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Process Control Functions"
HREF="ref.pcntl.html"><LINK
REL="PREVIOUS"
TITLE="pcntl_wait"
HREF="function.pcntl-wait.html"><LINK
REL="NEXT"
TITLE="pcntl_wexitstatus"
HREF="function.pcntl-wexitstatus.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.pcntl-wait.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.pcntl-wexitstatus.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.pcntl-waitpid"
></A
>pcntl_waitpid</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN170221"
></A
><P
>    (PHP 4 &#62;= 4.1.0, PHP 5)</P
>pcntl_waitpid&nbsp;--&nbsp;Waits on or returns the status of a forked child</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN170224"
></A
><H2
>说明</H2
>int <B
CLASS="methodname"
>pcntl_waitpid</B
> ( int pid, int &#38;status [, int options] )<BR
></BR
><P
>&#13;   Suspends execution of the current process until a child as specified by
   the <CODE
CLASS="parameter"
>pid</CODE
> argument has exited, or until a signal is
   delivered whose action is to terminate the current process or to call a
   signal handling function.
  </P
><P
>&#13;   If a child as requested by <CODE
CLASS="parameter"
>pid</CODE
> has already exited
   by the time of the call (a so-called "zombie" process), the function
   returns immediately.  Any system resources used by the child are freed.
   Please see your system's waitpid(2) man page for specific details as to
   how waitpid works on your system.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN170242"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>pid</CODE
></DT
><DD
><P
>&#13;       The value of <CODE
CLASS="parameter"
>pid</CODE
> can be one of the following:
       <DIV
CLASS="table"
><A
NAME="AEN170252"
></A
><P
><B
>表 1. possible values for <CODE
CLASS="parameter"
>pid</CODE
></B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><TBODY
><TR
><TD
><TT
CLASS="literal"
>&#60; -1</TT
></TD
><TD
>&#13;            wait for any child process whose process group ID is equal to
            the absolute value of <CODE
CLASS="parameter"
>pid</CODE
>.
           </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>-1</TT
></TD
><TD
>&#13;            wait for any child process; this is the same behaviour that
            the wait function exhibits.
           </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>0</TT
></TD
><TD
>&#13;            wait for any child process whose process group ID is equal to
            that of the calling process.
           </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>&#62; 0</TT
></TD
><TD
>&#13;            wait for the child whose process ID is equal to the value of
            <CODE
CLASS="parameter"
>pid</CODE
>.
           </TD
></TR
></TBODY
></TABLE
></DIV
>
      </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>
        Specifying <TT
CLASS="literal"
>-1</TT
> as the <CODE
CLASS="parameter"
>pid</CODE
> is
        equivalent to the functionality <A
HREF="function.pcntl-wait.html"
><B
CLASS="function"
>pcntl_wait()</B
></A
> provides
        (minus <CODE
CLASS="parameter"
>options</CODE
>).
       </P
></BLOCKQUOTE
></DIV
></DD
><DT
><CODE
CLASS="parameter"
>status</CODE
></DT
><DD
><P
>&#13;       <B
CLASS="function"
>pcntl_waitpid()</B
> will store status information
       in the <CODE
CLASS="parameter"
>status</CODE
> parameter which can be
       evaluated using the following functions:
       <A
HREF="function.pcntl-wifexited.html"
><B
CLASS="function"
>pcntl_wifexited()</B
></A
>,
       <A
HREF="function.pcntl-wifstopped.html"
><B
CLASS="function"
>pcntl_wifstopped()</B
></A
>,
       <A
HREF="function.pcntl-wifsignaled.html"
><B
CLASS="function"
>pcntl_wifsignaled()</B
></A
>,
       <A
HREF="function.pcntl-wexitstatus.html"
><B
CLASS="function"
>pcntl_wexitstatus()</B
></A
>,
       <A
HREF="function.pcntl-wtermsig.html"
><B
CLASS="function"
>pcntl_wtermsig()</B
></A
> and
       <A
HREF="function.pcntl-wstopsig.html"
><B
CLASS="function"
>pcntl_wstopsig()</B
></A
>.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>options</CODE
></DT
><DD
><P
>&#13;       The value of <CODE
CLASS="parameter"
>options</CODE
> is the value of zero
       or more of the following two global constants
       <TT
CLASS="literal"
>OR</TT
>'ed together:
       <DIV
CLASS="table"
><A
NAME="AEN170301"
></A
><P
><B
>表 2. possible values for <CODE
CLASS="parameter"
>options</CODE
></B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><TBODY
><TR
><TD
><TT
CLASS="literal"
>WNOHANG</TT
></TD
><TD
>&#13;            return immediately if no child has exited.
           </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>WUNTRACED</TT
></TD
><TD
>&#13;            return for children which are stopped, and whose status has
            not been reported.
           </TD
></TR
></TBODY
></TABLE
></DIV
>
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN170314"
></A
><H2
>返回值</H2
><P
>&#13;   <B
CLASS="function"
>pcntl_waitpid()</B
> returns the process ID of the
   child which exited, -1 on error or zero if WNOHANG was used and no
   child was available
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN170318"
></A
><H2
>参见</H2
><P
>&#13;   <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="function.pcntl-fork.html"
><B
CLASS="function"
>pcntl_fork()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.pcntl-signal.html"
><B
CLASS="function"
>pcntl_signal()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.pcntl-wifexited.html"
><B
CLASS="function"
>pcntl_wifexited()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.pcntl-wifstopped.html"
><B
CLASS="function"
>pcntl_wifstopped()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.pcntl-wifsignaled.html"
><B
CLASS="function"
>pcntl_wifsignaled()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.pcntl-wexitstatus.html"
><B
CLASS="function"
>pcntl_wexitstatus()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.pcntl-wtermsig.html"
><B
CLASS="function"
>pcntl_wtermsig()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.pcntl-wstopsig.html"
><B
CLASS="function"
>pcntl_wstopsig()</B
></A
></TD
></TR
></TBODY
></TABLE
><P
></P
>
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.pcntl-wait.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.pcntl-wexitstatus.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>pcntl_wait</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.pcntl.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>pcntl_wexitstatus</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>