[DOC-CVS] [doc-en] master: Document pcntl_getqos_class and pcntl_setqos_class (#5506)

[email protected] (Kamil Tekiela via GitHub) Thu, 23 Apr 2026 16:44:25 +0000
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Kamil Tekiela (kamil-tekiela)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2026-04-23T17:44:23+01:00

Commit: https://github.com/php/doc-en/commit/30b0c51175bb9bc5a329d7924b0ca5eff1f1f9ad
Raw diff: https://github.com/php/doc-en/commit/30b0c51175bb9bc5a329d7924b0ca5eff1f1f9ad.diff

Document pcntl_getqos_class and pcntl_setqos_class (#5506)

Co-authored-by: Louis-Arnaud <[email protected]>
Co-authored-by: David CARLIER <[email protected]>

Changed paths:
  A  reference/pcntl/functions/pcntl_getqos_class.xml
  A  reference/pcntl/functions/pcntl_setqos_class.xml
  M  appendices/migration84/new-functions.xml
  M  reference/pcntl/versions.xml


Diff:

diff --git a/appendices/migration84/new-functions.xml b/appendices/migration84/new-functions.xml
index fbb4b28092b3..66cf8ea318ad 100644
--- a/appendices/migration84/new-functions.xml
+++ b/appendices/migration84/new-functions.xml
@@ -120,6 +120,7 @@
    <member><function>pcntl_getcpuaffinity</function></member>
    <member><function>pcntl_getqos_class</function></member>
    <member><function>pcntl_setns</function></member>
+   <member><function>pcntl_setqos_class</function></member>
    <member><function>pcntl_waitid</function></member>
   </simplelist>
  </sect2>
diff --git a/reference/pcntl/functions/pcntl_getqos_class.xml b/reference/pcntl/functions/pcntl_getqos_class.xml
new file mode 100644
index 000000000000..83d16d1424b6
--- /dev/null
+++ b/reference/pcntl/functions/pcntl_getqos_class.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="function.pcntl-getqos-class" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+  <refname>pcntl_getqos_class</refname>
+  <refpurpose>Get the QoS class of the current thread</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+  &reftitle.description;
+  <methodsynopsis>
+   <type>Pcntl\QosClass</type><methodname>pcntl_getqos_class</methodname>
+   <void/>
+  </methodsynopsis>
+  <simpara>
+   Retrieve the QoS class.
+  </simpara>
+  <note>
+   <simpara>This function is only available on Apple platforms.</simpara>
+  </note>
+ </refsect1>
+
+ <refsect1 role="parameters">
+  &reftitle.parameters;
+  &no.function.parameters;
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+  &reftitle.returnvalues;
+  <simpara>
+   Returns the <enumname>Pcntl\QosClass</enumname>.
+  </simpara>
+ </refsect1>
+
+ <refsect1 role="errors">
+  &reftitle.errors;
+  <simpara>
+   Throws an <classname>Error</classname> if the underlying call to
+   <literal>pthread_get_qos_class_np()</literal> fails.
+  </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <simplelist>
+   <member><function>pcntl_setqos_class</function></member>
+   <member><enumname>Pcntl\QosClass</enumname></member>
+  </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/pcntl/functions/pcntl_setqos_class.xml b/reference/pcntl/functions/pcntl_setqos_class.xml
new file mode 100644
index 000000000000..113272c0305a
--- /dev/null
+++ b/reference/pcntl/functions/pcntl_setqos_class.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="function.pcntl-setqos-class" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+  <refname>pcntl_setqos_class</refname>
+  <refpurpose>Set the QoS class of the current thread</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+  &reftitle.description;
+  <methodsynopsis>
+   <type>void</type><methodname>pcntl_setqos_class</methodname>
+   <methodparam choice="opt"><type>Pcntl\QosClass</type><parameter>qos_class</parameter><initializer><constant>Pcntl\QosClass::Default</constant></initializer></methodparam>
+  </methodsynopsis>
+  <simpara>
+   Set the QoS class.
+  </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+  &reftitle.parameters;
+  <variablelist>
+   <varlistentry>
+    <term><parameter>qos_class</parameter></term>
+    <listitem>
+     <para>
+      The Quality of Service class to assign to the current thread. The
+      operating system uses this as a hint to schedule CPU time, I/O priority,
+      and energy usage, with higher classes preempting lower ones. See
+      <enumname>Pcntl\QosClass</enumname> for the available cases.
+     </para>
+     <para>
+      <variablelist>
+       <varlistentry>
+        <term><constant>Pcntl\QosClass::UserInteractive</constant></term>
+        <listitem>
+         <simpara>
+          Highest priority. Intended for work that directly drives a user
+          interface and must complete virtually instantly to avoid perceived
+          delay, such as event handling or drawing.
+         </simpara>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term><constant>Pcntl\QosClass::UserInitiated</constant></term>
+        <listitem>
+         <simpara>
+          High priority, just below <constant>UserInteractive</constant>.
+          Intended for work the user has explicitly initiated and is actively
+          waiting on, expected to complete within a few seconds.
+         </simpara>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term><constant>Pcntl\QosClass::Default</constant></term>
+        <listitem>
+         <simpara>
+          Standard priority, used when no more specific class applies. Runs
+          after higher-priority work but ahead of <constant>Utility</constant>
+          and <constant>Background</constant>.
+         </simpara>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term><constant>Pcntl\QosClass::Utility</constant></term>
+        <listitem>
+         <simpara>
+          Lower priority, intended for long-running work the user is aware of
+          but not actively waiting on, such as downloads, imports, or bulk
+          computation. Scheduled in an energy-efficient manner.
+         </simpara>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term><constant>Pcntl\QosClass::Background</constant></term>
+        <listitem>
+         <simpara>
+          Lowest priority, intended for work the user is not aware of, such as
+          prefetching, indexing, or maintenance. Heavily optimized for energy
+          efficiency and may be deferred when the system is under load.
+         </simpara>
+        </listitem>
+       </varlistentry>
+      </variablelist>
+     </para>
+    </listitem>
+   </varlistentry>
+  </variablelist>
+  <note>
+   <simpara>This function is only available on Apple platforms.</simpara>
+  </note>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+  &reftitle.returnvalues;
+  <simpara>
+   &return.void;
+  </simpara>
+ </refsect1>
+
+ <refsect1 role="errors">
+  &reftitle.errors;
+  <simpara>
+   Throws an <classname>Error</classname> if the underlying call to
+   <literal>pthread_set_qos_class_self_np()</literal> fails.
+  </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <simplelist>
+   <member><function>pcntl_getqos_class</function></member>
+   <member><enumname>Pcntl\QosClass</enumname></member>
+  </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/pcntl/versions.xml b/reference/pcntl/versions.xml
index b00421970981..43ce02dd9a5e 100644
--- a/reference/pcntl/versions.xml
+++ b/reference/pcntl/versions.xml
@@ -10,11 +10,13 @@
  <function name="pcntl_exec" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_fork" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_getcpuaffinity" from="PHP 8 &gt;= 8.4.0"/>
+ <function name="pcntl_getqos_class" from="PHP 8 &gt;= 8.4.0"/>
  <function name="pcntl_getpriority" from="PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_get_last_error" from="PHP 5 &gt;= 5.3.4, PHP 7, PHP 8"/>
  <function name="pcntl_rfork" from="PHP 8 &gt;= 8.1.0"/>
  <function name="pcntl_setcpuaffinity" from="PHP 8 &gt;= 8.4.0"/>
  <function name="pcntl_setpriority" from="PHP 5, PHP 7, PHP 8"/>
+ <function name="pcntl_setqos_class" from="PHP 8 &gt;= 8.4.0"/>
  <function name="pcntl_signal" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_signal_dispatch" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8"/>
  <function name="pcntl_signal_get_handler" from="PHP 7 &gt;= 7.1.0, PHP 8"/>
@@ -32,7 +34,7 @@
  <function name="pcntl_wifstopped" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_wstopsig" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_wtermsig" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
- <function name="qosclass" from="PHP 8 &gt;= 8.4.0"/>
+ <function name="pcntl\qosclass" from="PHP 8 &gt;= 8.4.0"/>
 </versions>
 <!-- Keep this comment at the end of the file
 Local variables: