uTools-Manuals/docs/php/proc_nice.html
2019-04-08 23:22:26 +08:00

192 lines
6.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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.proc-nice" class="refentry">
<div class="refnamediv">
<h1 class="refname">proc_nice</h1>
<p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">proc_nice</span> &mdash; <span class="dc-title">修改当前进程的优先级</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.proc-nice-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>proc_nice</strong></span>
( <span class="methodparam"><span class="type">int</span> <code class="parameter">$increment</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>proc_nice()</strong></span> 修改当前进程的优先级,
修改量由 <code class="parameter">increment</code> 参数指定。
<code class="parameter">increment</code> 为正数会降低当前进程优先级,
反之,为负数会提高优先级。
</p>
<p class="para">
<span class="function"><strong>proc_nice()</strong></span>
<span class="function"><a href="proc_open.html" class="function">proc_open()</a></span> 函数以及和 <span class="function"><a href="proc_open.html" class="function">proc_open()</a></span> 相关的函数并无什么关系。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.proc-nice-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">increment</code></dt>
<dd>
<p class="para">
新的优先级值,具体的设定取决于所运行的平台。
</p>
<p class="para">
在 Unix 系统上,较小的值表示较高的优先级,例如:<em>-20</em>
而正数值表示更低的优先级。
</p>
<p class="para">
在 Windows 平台上,<code class="parameter">increment</code> 参数
的含义如下:
</p>
<table class="doctable informaltable">
<thead>
<tr>
<th>优先级</th>
<th>可能的值</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td style="vertical-align: top;">高优先级</td>
<td style="vertical-align: top;">
<code class="parameter">increment</code> <em>&lt; -9</em>
</td>
</tr>
<tr>
<td style="vertical-align: top;">较高优先级</td>
<td style="vertical-align: top;">
<code class="parameter">increment</code> <em>&lt; -4</em>
</td>
</tr>
<tr>
<td style="vertical-align: top;">正常优先级</td>
<td style="vertical-align: top;">
<code class="parameter">increment</code> <em>&lt; 5</em> &amp;
<code class="parameter">increment</code> <em>&gt; -5</em>
</td>
</tr>
<tr>
<td style="vertical-align: top;">较低优先级</td>
<td style="vertical-align: top;">
<code class="parameter">increment</code> <em>&gt; 5</em>
</td>
</tr>
<tr>
<td style="vertical-align: top;">低优先级</td>
<td style="vertical-align: top;">
<code class="parameter">increment</code> <em>&gt; 9</em>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.proc-nice-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>。。
如果发生错误,例如用户无权修改当前进程的优先级,
会生成 <strong><code>E_WARNING</code></strong> 级别的错误。
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.proc-nice-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4360">
<p><strong>Example #1 使用 <span class="function"><a href="proc_open.html" class="function">proc_open()</a></span> 函数将进程设置为高优先级</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Highest&nbsp;priority<br /></span><span style="color: #0000BB">proc_nice</span><span style="color: #007700">(-</span><span style="color: #0000BB">20</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.proc-nice-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>7.2.0</td>
<td>
在 Windows 平台上可用。
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.proc-nice-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<strong>可用性</strong><br />
<p class="para">
仅在具有 &#039;nice&#039; 能力的系统上才可以使用 <span class="function"><strong>proc_nice()</strong></span> 函数。
下列系统含有 &#039;nice&#039;SVr4, SVID EXT, AT&amp;T, X/OPEN, BSD 4.3。
</p>
</p></blockquote>
<blockquote class="note"><p><strong class="note">Note</strong>:
<strong>Windows 平台</strong><br />
<p class="para">
<span class="function"><strong>proc_nice()</strong></span> 函数会改变 <em class="emphasis">当前</em>
进程优先级,即使 PHP 是使用线程安全模式编译的。
</p>
</p></blockquote>
</div>
</div></div></div></body></html>