mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
137 lines
6.3 KiB
HTML
137 lines
6.3 KiB
HTML
<!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>等待信号</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.pcntl-sigwaitinfo" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">pcntl_sigwaitinfo</h1>
|
||
<p class="verinfo">(PHP 5 >= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">pcntl_sigwaitinfo</span> — <span class="dc-title">等待信号</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.pcntl-sigwaitinfo-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>pcntl_sigwaitinfo</strong></span>
|
||
( <span class="methodparam"><span class="type">array</span> <code class="parameter">$set</code></span>
|
||
[, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$siginfo</code></span>
|
||
] ) : <span class="type">int</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>pcntl_sigwaitinfo()</strong></span>函数暂停调用脚本的执行直到接收到<code class="parameter">set</code>
|
||
参数中列出的某个信号。只要其中的一个信号已经在等待状态(比如: 通过
|
||
<span class="function"><a href="pcntl_sigprocmask.html" class="function">pcntl_sigprocmask()</a></span>函数阻塞),
|
||
函数<span class="function"><strong>pcntl_sigwaitinfo()</strong></span>就回立刻返回。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.pcntl-sigwaitinfo-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">set</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
要等待的信号数组。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">siginfo</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
<code class="parameter">siginfo</code>是一个输出参数,用来返回信号的信息。
|
||
</p>
|
||
<p class="para">
|
||
以下元素会为所有信号设置:
|
||
<ul class="simplelist">
|
||
<li class="member">signo: 信号编号</li>
|
||
<li class="member">errno: 错误编号</li>
|
||
<li class="member">code: 信号代码</li>
|
||
</ul>
|
||
</p>
|
||
<p class="para">
|
||
下面元素可能会为<strong><code>SIGCHLD</code></strong>信号设置:
|
||
<ul class="simplelist">
|
||
<li class="member">status: 退出的值或信号</li>
|
||
<li class="member">utime: 用户消耗的时间</li>
|
||
<li class="member">stime: 系统(内核)消耗的时间</li>
|
||
<li class="member">pid: 发送进程ID</li>
|
||
<li class="member">uid: 发送进程的实际用户ID</li>
|
||
</ul>
|
||
</p>
|
||
<p class="para">
|
||
信号<strong><code>SIGILL</code></strong>,
|
||
<strong><code>SIGFPE</code></strong>, <strong><code>SIGSEGV</code></strong> 和
|
||
<strong><code>SIGBUS</code></strong> 可能会被设置的元素:
|
||
<ul class="simplelist">
|
||
<li class="member">addr: 发生故障的内存位置</li>
|
||
</ul>
|
||
</p>
|
||
<p class="para">
|
||
可能会为<strong><code>SIGPOLL</code></strong>
|
||
信号设置的元素:
|
||
<ul class="simplelist">
|
||
<li class="member">band: Band event</li>
|
||
<li class="member">fd: 文件描述符</li>
|
||
</ul>
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.pcntl-sigwaitinfo-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时,函数<span class="function"><strong>pcntl_sigwaitinfo()</strong></span>返回一个信号编号。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.pcntl-sigwaitinfo-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-4330">
|
||
<p><strong>Example #1 <span class="function"><strong>pcntl_sigwaitinfo()</strong></span> example</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"Blocking SIGHUP signal\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">pcntl_sigprocmask</span><span style="color: #007700">(</span><span style="color: #0000BB">SIG_BLOCK</span><span style="color: #007700">, array(</span><span style="color: #0000BB">SIGHUP</span><span style="color: #007700">));<br /><br />echo </span><span style="color: #DD0000">"Sending SIGHUP to self\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">posix_kill</span><span style="color: #007700">(</span><span style="color: #0000BB">posix_getpid</span><span style="color: #007700">(), </span><span style="color: #0000BB">SIGHUP</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"Waiting for signals\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$info </span><span style="color: #007700">= array();<br /></span><span style="color: #0000BB">pcntl_sigwaitinfo</span><span style="color: #007700">(array(</span><span style="color: #0000BB">SIGHUP</span><span style="color: #007700">), </span><span style="color: #0000BB">$info</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.pcntl-sigwaitinfo-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="pcntl_sigprocmask.html" class="function" rel="rdfs-seeAlso">pcntl_sigprocmask()</a> - 设置或检索阻塞信号</span></li>
|
||
<li class="member"><span class="function"><a href="pcntl_sigtimedwait.html" class="function" rel="rdfs-seeAlso">pcntl_sigtimedwait()</a> - 带超时机制的信号等待</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |