Skip to content

Commit 9c9c974

Browse files
authored
Sync pcntl functions (#974)
1 parent e92300e commit 9c9c974

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

reference/pcntl/functions/pcntl-signal.xml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: b890f28c0c6d2856eadcdc34b3faf83a846b3d79 Maintainer: mowangjuanzi Status: ready -->
3+
<!-- EN-Revision: e91b2dd2539f6be30b7db023d880de673fa50b62 Maintainer: mowangjuanzi Status: ready -->
4+
<!-- CREDITS: Luffy -->
45
<refentry xml:id="function.pcntl-signal" xmlns="http://docbook.org/ns/docbook">
56
<refnamediv>
67
<refname>pcntl_signal</refname>
@@ -127,8 +128,7 @@
127128
<programlisting role="php">
128129
<![CDATA[
129130
<?php
130-
// 需要使用 ticks
131-
declare(ticks = 1);
131+
pcntl_async_signals(true);
132132
133133
// 信号处理函数
134134
function sig_handler($signo)
@@ -181,13 +181,30 @@ echo "Done\n";
181181
<para>
182182
<function>pcntl_signal</function> 不堆叠信号处理程序,而是替换。
183183
</para>
184+
<refsect2>
185+
<title>调度方式</title>
186+
<para>
187+
调度信号处理程序的方法有多种:
188+
<simplelist>
189+
<member>启用 <function>pcntl_async_signals</function> 异步调度。这是推荐方法</member>
190+
<member>设置 <link linkend="control-structures.declare.ticks">tick</link> 频率</member>
191+
<member>使用 <function>pcntl_signal_dispatch</function> 手动调度</member>
192+
</simplelist>
193+
</para>
194+
<para>
195+
当信号以异步方式或使用基于 tick 的执行调度时,阻塞函数(如 <function>sleep</function>)可能会被中断。
196+
</para>
197+
</refsect2>
184198
</refsect1><!-- }}} -->
185199

186200
<refsect1 role="seealso">
187201
&reftitle.seealso;
188202
<para>
189203
<simplelist>
204+
<member><link xlink:href="https://en.wikipedia.org/wiki/Signal_(IPC)">Signal (IPC)</link> on Wikipedia</member>
205+
<member><function>pcntl_async_signals</function></member>
190206
<member><function>pcntl_fork</function></member>
207+
<member><function>pcntl_signal_dispatch</function></member>
191208
<member><function>pcntl_waitpid</function></member>
192209
</simplelist>
193210
</para>

reference/pcntl/functions/pcntl-waitpid.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 61374bbe228e8e9c55a24aba59a1e2bb2a871148 Maintainer: mowangjuanzi Status: ready -->
3+
<!-- EN-Revision: a747e132c5506a0273c686cbe20e227c980d8ec7 Maintainer: mowangjuanzi Status: ready -->
44
<!-- CREDITS: Luffy -->
55
<refentry xml:id="function.pcntl-waitpid" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -49,7 +49,7 @@
4949
<row>
5050
<entry><literal>-1</literal></entry>
5151
<entry>
52-
等待任意子进程;与 wait 函数行为一致。
52+
等待任意子进程;与 <function>pcntl_wait</function> 函数行为一致。
5353
</entry>
5454
</row>
5555
<row>

reference/reflection/propertyhooktype.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: bb7c286b13ab0b57d680f099cef5224348028a90 Maintainer: mowangjuanzi Status: ready -->
3-
<reference xmlns="http://docbook.org/ns/docbook" xml:id="enum.reflection.propertyhooktype" role="enum">
2+
<!-- EN-Revision: 0cc604f2db478345bff5ade4e191111d5cbfbd90 Maintainer: mowangjuanzi Status: ready -->
3+
<!-- CREDITS: Luffy -->
4+
<reference xmlns="http://docbook.org/ns/docbook" xml:id="enum.propertyhooktype" role="enum">
45
<title>PropertyHookType 枚举</title>
56
<titleabbrev>PropertyHookType</titleabbrev>
67

78
<partintro>
8-
<section xml:id="enum.reflection.propertyhooktype.intro">
9+
<section xml:id="enum.propertyhooktype.intro">
910
&reftitle.intro;
1011
<simpara>
1112
<enumname>PropertyHookType</enumname> 枚举列出了<link linkend="language.oop5.property-hooks">属性挂钩</link>的合法类型。
1213
</simpara>
1314
</section>
1415

15-
<section xml:id="enum.reflection.propertyhooktype.synopsis">
16+
<section xml:id="enum.propertyhooktype.synopsis">
1617
&reftitle.enumsynopsis;
1718

1819
<enumsynopsis>

reference/var/functions/intval.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 18c4f78a828232c909056490ccf0a858d002e6ef Maintainer: daijie Status: ready -->
3+
<!-- EN-Revision: ec0d6933217236658dd6615c0b2293e1469fd851 Maintainer: daijie Status: ready -->
44
<!-- CREDITS: Luffy -->
55
<refentry xml:id="function.intval" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -127,7 +127,7 @@
127127
<![CDATA[
128128
<?php
129129
echo intval(42); // 42
130-
echo intval(4.2); // 4
130+
echo intval(4.7); // 4
131131
echo intval('42'); // 42
132132
echo intval('+42'); // 42
133133
echo intval('-42'); // -42

0 commit comments

Comments
 (0)