<?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-getpriority.php',
    1 => 'pcntl_getpriority',
    2 => '获取任意进程的优先级',
  ),
  'up' => 
  array (
    0 => 'ref.pcntl.php',
    1 => 'PCNTL 函数',
  ),
  'prev' => 
  array (
    0 => 'function.pcntl-getcpuaffinity.php',
    1 => 'pcntl_getcpuaffinity',
  ),
  'next' => 
  array (
    0 => 'function.pcntl-getqos-class.php',
    1 => 'pcntl_getqos_class',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/pcntl/functions/pcntl-getpriority.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pcntl-getpriority" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pcntl_getpriority</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pcntl_getpriority</span> &mdash; <span class="dc-title">获取任意进程的优先级</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pcntl-getpriority-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pcntl_getpriority</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$process_id</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = <strong><code><a href="pcntl.constants.php#constant.prio-process">PRIO_PROCESS</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>pcntl_getpriority()</strong></span> 获取进程号为
   <code class="parameter">process_id</code> 的进程的优先级。由于不同的系统类型以及内核版本下
   优先级可能不同，因此请参考系统的 getpriority（2）手册以获取详细的规范。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pcntl-getpriority-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">process_id</code></dt>
     <dd>
      <p class="para">
       如果为 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>，默认使用当前进程的进程号。
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       <strong><code><a href="pcntl.constants.php#constant.prio-pgrp">PRIO_PGRP</a></code></strong>（译注：获取进程组优先级）、<strong><code><a href="pcntl.constants.php#constant.prio-user">PRIO_USER</a></code></strong>（译注：获取用户进程优先级）、<strong><code>PRIO_PROCESS（译注：默认值;获取进程优先级）</code></strong>、<strong><code><a href="pcntl.constants.php#constant.prio-darwin-bg">PRIO_DARWIN_BG</a></code></strong>
       或 <strong><code><a href="pcntl.constants.php#constant.prio-darwin-thread">PRIO_DARWIN_THREAD</a></code></strong> 之一。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pcntl-getpriority-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   <span class="function"><strong>pcntl_getpriority()</strong></span> 返回进程的优先级或在错误时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。值越小代表优先级越高。
  </p>
  <div class="warning"><strong class="warning">警告</strong><p class="simpara">此函数可能返回布尔值
<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>，但也可能返回等同于 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> 的非布尔值。请阅读 <a href="language.types.boolean.php" class="link">布尔类型</a>章节以获取更多信息。应使用
<a href="language.operators.comparison.php" class="link">===
运算符</a>来测试此函数的返回值。</p></div>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pcntl-getpriority-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">process_id</code> 现在可以为 null。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.pcntl-getpriority-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.pcntl-setpriority.php" class="function" rel="rdfs-seeAlso">pcntl_setpriority()</a> - 修改任意进程的优先级</span></li>
   </ul>
  </p>
 </div>


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