pcntl_setqos_class
(PHP 8 >= 8.4.0)
Set the QoS class of the current thread
Description
Sets the Quality of Service (QoS) class of the current thread.
Parameters
qos_classThe 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
Pcntl\QosClassfor the available cases.Pcntl\QosClass::UserInteractiveHighest 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.
Pcntl\QosClass::UserInitiatedHigh priority, just below
UserInteractive. Intended for work the user has explicitly initiated and is actively waiting on, expected to complete within a few seconds.Pcntl\QosClass::DefaultStandard priority, used when no more specific class applies. Runs after higher-priority work but ahead of
UtilityandBackground.Pcntl\QosClass::UtilityLower 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.
Pcntl\QosClass::BackgroundLowest 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.
This function is only available on Apple platforms.
Return Values
Void
Errors/Exceptions
Throws an Error if the underlying call to pthread_set_qos_class_self_np() fails.
See Also
pcntl_getqos_class()Pcntl\QosClass