Skip to content

Commit 30b0c51

Browse files
kamil-tekielalacatoiredevnexen
authored
Document pcntl_getqos_class and pcntl_setqos_class (#5506)
Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> Co-authored-by: David CARLIER <devnexen@gmail.com>
1 parent 0194deb commit 30b0c51

4 files changed

Lines changed: 212 additions & 1 deletion

File tree

appendices/migration84/new-functions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
<member><function>pcntl_getcpuaffinity</function></member>
121121
<member><function>pcntl_getqos_class</function></member>
122122
<member><function>pcntl_setns</function></member>
123+
<member><function>pcntl_setqos_class</function></member>
123124
<member><function>pcntl_waitid</function></member>
124125
</simplelist>
125126
</sect2>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="function.pcntl-getqos-class" xmlns="http://docbook.org/ns/docbook">
4+
<refnamediv>
5+
<refname>pcntl_getqos_class</refname>
6+
<refpurpose>Get the QoS class of the current thread</refpurpose>
7+
</refnamediv>
8+
9+
<refsect1 role="description">
10+
&reftitle.description;
11+
<methodsynopsis>
12+
<type>Pcntl\QosClass</type><methodname>pcntl_getqos_class</methodname>
13+
<void/>
14+
</methodsynopsis>
15+
<simpara>
16+
Retrieve the QoS class.
17+
</simpara>
18+
<note>
19+
<simpara>This function is only available on Apple platforms.</simpara>
20+
</note>
21+
</refsect1>
22+
23+
<refsect1 role="parameters">
24+
&reftitle.parameters;
25+
&no.function.parameters;
26+
</refsect1>
27+
28+
<refsect1 role="returnvalues">
29+
&reftitle.returnvalues;
30+
<simpara>
31+
Returns the <enumname>Pcntl\QosClass</enumname>.
32+
</simpara>
33+
</refsect1>
34+
35+
<refsect1 role="errors">
36+
&reftitle.errors;
37+
<simpara>
38+
Throws an <classname>Error</classname> if the underlying call to
39+
<literal>pthread_get_qos_class_np()</literal> fails.
40+
</simpara>
41+
</refsect1>
42+
43+
<refsect1 role="seealso">
44+
&reftitle.seealso;
45+
<simplelist>
46+
<member><function>pcntl_setqos_class</function></member>
47+
<member><enumname>Pcntl\QosClass</enumname></member>
48+
</simplelist>
49+
</refsect1>
50+
51+
</refentry>
52+
<!-- Keep this comment at the end of the file
53+
Local variables:
54+
mode: sgml
55+
sgml-omittag:t
56+
sgml-shorttag:t
57+
sgml-minimize-attributes:nil
58+
sgml-always-quote-attributes:t
59+
sgml-indent-step:1
60+
sgml-indent-data:t
61+
indent-tabs-mode:nil
62+
sgml-parent-document:nil
63+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
64+
sgml-exposed-tags:nil
65+
sgml-local-catalogs:nil
66+
sgml-local-ecat-files:nil
67+
End:
68+
vim600: syn=xml fen fdm=syntax fdl=2 si
69+
vim: et tw=78 syn=sgml
70+
vi: ts=1 sw=1
71+
-->
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="function.pcntl-setqos-class" xmlns="http://docbook.org/ns/docbook">
4+
<refnamediv>
5+
<refname>pcntl_setqos_class</refname>
6+
<refpurpose>Set the QoS class of the current thread</refpurpose>
7+
</refnamediv>
8+
9+
<refsect1 role="description">
10+
&reftitle.description;
11+
<methodsynopsis>
12+
<type>void</type><methodname>pcntl_setqos_class</methodname>
13+
<methodparam choice="opt"><type>Pcntl\QosClass</type><parameter>qos_class</parameter><initializer><constant>Pcntl\QosClass::Default</constant></initializer></methodparam>
14+
</methodsynopsis>
15+
<simpara>
16+
Set the QoS class.
17+
</simpara>
18+
</refsect1>
19+
20+
<refsect1 role="parameters">
21+
&reftitle.parameters;
22+
<variablelist>
23+
<varlistentry>
24+
<term><parameter>qos_class</parameter></term>
25+
<listitem>
26+
<para>
27+
The Quality of Service class to assign to the current thread. The
28+
operating system uses this as a hint to schedule CPU time, I/O priority,
29+
and energy usage, with higher classes preempting lower ones. See
30+
<enumname>Pcntl\QosClass</enumname> for the available cases.
31+
</para>
32+
<para>
33+
<variablelist>
34+
<varlistentry>
35+
<term><constant>Pcntl\QosClass::UserInteractive</constant></term>
36+
<listitem>
37+
<simpara>
38+
Highest priority. Intended for work that directly drives a user
39+
interface and must complete virtually instantly to avoid perceived
40+
delay, such as event handling or drawing.
41+
</simpara>
42+
</listitem>
43+
</varlistentry>
44+
<varlistentry>
45+
<term><constant>Pcntl\QosClass::UserInitiated</constant></term>
46+
<listitem>
47+
<simpara>
48+
High priority, just below <constant>UserInteractive</constant>.
49+
Intended for work the user has explicitly initiated and is actively
50+
waiting on, expected to complete within a few seconds.
51+
</simpara>
52+
</listitem>
53+
</varlistentry>
54+
<varlistentry>
55+
<term><constant>Pcntl\QosClass::Default</constant></term>
56+
<listitem>
57+
<simpara>
58+
Standard priority, used when no more specific class applies. Runs
59+
after higher-priority work but ahead of <constant>Utility</constant>
60+
and <constant>Background</constant>.
61+
</simpara>
62+
</listitem>
63+
</varlistentry>
64+
<varlistentry>
65+
<term><constant>Pcntl\QosClass::Utility</constant></term>
66+
<listitem>
67+
<simpara>
68+
Lower priority, intended for long-running work the user is aware of
69+
but not actively waiting on, such as downloads, imports, or bulk
70+
computation. Scheduled in an energy-efficient manner.
71+
</simpara>
72+
</listitem>
73+
</varlistentry>
74+
<varlistentry>
75+
<term><constant>Pcntl\QosClass::Background</constant></term>
76+
<listitem>
77+
<simpara>
78+
Lowest priority, intended for work the user is not aware of, such as
79+
prefetching, indexing, or maintenance. Heavily optimized for energy
80+
efficiency and may be deferred when the system is under load.
81+
</simpara>
82+
</listitem>
83+
</varlistentry>
84+
</variablelist>
85+
</para>
86+
</listitem>
87+
</varlistentry>
88+
</variablelist>
89+
<note>
90+
<simpara>This function is only available on Apple platforms.</simpara>
91+
</note>
92+
</refsect1>
93+
94+
<refsect1 role="returnvalues">
95+
&reftitle.returnvalues;
96+
<simpara>
97+
&return.void;
98+
</simpara>
99+
</refsect1>
100+
101+
<refsect1 role="errors">
102+
&reftitle.errors;
103+
<simpara>
104+
Throws an <classname>Error</classname> if the underlying call to
105+
<literal>pthread_set_qos_class_self_np()</literal> fails.
106+
</simpara>
107+
</refsect1>
108+
109+
<refsect1 role="seealso">
110+
&reftitle.seealso;
111+
<simplelist>
112+
<member><function>pcntl_getqos_class</function></member>
113+
<member><enumname>Pcntl\QosClass</enumname></member>
114+
</simplelist>
115+
</refsect1>
116+
117+
</refentry>
118+
<!-- Keep this comment at the end of the file
119+
Local variables:
120+
mode: sgml
121+
sgml-omittag:t
122+
sgml-shorttag:t
123+
sgml-minimize-attributes:nil
124+
sgml-always-quote-attributes:t
125+
sgml-indent-step:1
126+
sgml-indent-data:t
127+
indent-tabs-mode:nil
128+
sgml-parent-document:nil
129+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
130+
sgml-exposed-tags:nil
131+
sgml-local-catalogs:nil
132+
sgml-local-ecat-files:nil
133+
End:
134+
vim600: syn=xml fen fdm=syntax fdl=2 si
135+
vim: et tw=78 syn=sgml
136+
vi: ts=1 sw=1
137+
-->

reference/pcntl/versions.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
<function name="pcntl_exec" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
1111
<function name="pcntl_fork" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
1212
<function name="pcntl_getcpuaffinity" from="PHP 8 &gt;= 8.4.0"/>
13+
<function name="pcntl_getqos_class" from="PHP 8 &gt;= 8.4.0"/>
1314
<function name="pcntl_getpriority" from="PHP 5, PHP 7, PHP 8"/>
1415
<function name="pcntl_get_last_error" from="PHP 5 &gt;= 5.3.4, PHP 7, PHP 8"/>
1516
<function name="pcntl_rfork" from="PHP 8 &gt;= 8.1.0"/>
1617
<function name="pcntl_setcpuaffinity" from="PHP 8 &gt;= 8.4.0"/>
1718
<function name="pcntl_setpriority" from="PHP 5, PHP 7, PHP 8"/>
19+
<function name="pcntl_setqos_class" from="PHP 8 &gt;= 8.4.0"/>
1820
<function name="pcntl_signal" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
1921
<function name="pcntl_signal_dispatch" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8"/>
2022
<function name="pcntl_signal_get_handler" from="PHP 7 &gt;= 7.1.0, PHP 8"/>
@@ -32,7 +34,7 @@
3234
<function name="pcntl_wifstopped" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
3335
<function name="pcntl_wstopsig" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
3436
<function name="pcntl_wtermsig" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
35-
<function name="qosclass" from="PHP 8 &gt;= 8.4.0"/>
37+
<function name="pcntl\qosclass" from="PHP 8 &gt;= 8.4.0"/>
3638
</versions>
3739
<!-- Keep this comment at the end of the file
3840
Local variables:

0 commit comments

Comments
 (0)