<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pcntl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.pcntl-alarm.php',
    1 => 'pcntl_alarm',
    2 => '为进程设置 alarm 闹钟信号',
  ),
  'up' => 
  array (
    0 => 'ref.pcntl.php',
    1 => 'PCNTL 函数',
  ),
  'prev' => 
  array (
    0 => 'ref.pcntl.php',
    1 => 'PCNTL 函数',
  ),
  'next' => 
  array (
    0 => 'function.pcntl-async-signals.php',
    1 => 'pcntl_async_signals',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/pcntl/functions/pcntl-alarm.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pcntl-alarm" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pcntl_alarm</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pcntl_alarm</span> &mdash; <span class="dc-title">为进程设置 alarm 闹钟信号</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pcntl-alarm-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pcntl_alarm</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$seconds</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   创建计时器，在指定的秒数后向进程发送 <strong><code><a href="pcntl.constants.php#constant.sigalrm">SIGALRM</a></code></strong> 信号。每次对
   <span class="function"><strong>pcntl_alarm()</strong></span> 的调用都会取消之前设置的 alarm 信号。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pcntl-alarm-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">seconds</code></dt>
     <dd>
      <p class="para">
       等待的秒数。如果 <code class="parameter">seconds</code> 设置为 0,将不会创建 alarm 信号。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pcntl-alarm-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
  返回上次 alarm 调度（离 alarm 信号发送）剩余的秒数，或者之前没有 alarm 调度（译注：或者之前调度已完成）
  时返回 <code class="literal">0</code>。
  </p>
 </div>


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