大网数据广告活动
PHP 语言与运行手册

pcntl_setqos_class · Set the QoS class of the current thread

· 52CE 我爱测

pcntl_setqos_class — Set the QoS class of the current thread

pcntl_setqos_class

(PHP 8 >= 8.4.0)

pcntl_setqos_class — Set the QoS class of the current thread

Description

function pcntl_setqos_class(Pcntl\QosClass $qos_class = Pcntl\QosClass::Default): void

Sets the Quality of Service (QoS) class of the current thread.

Parameters

qos_class

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 Pcntl\QosClass for the available cases.

Pcntl\QosClass::UserInteractive

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.

Pcntl\QosClass::UserInitiated

High 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::Default

Standard priority, used when no more specific class applies. Runs after higher-priority work but ahead of Utility and Background.

Pcntl\QosClass::Utility

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.

Pcntl\QosClass::Background

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.

Note:

This function is only available on Apple platforms.

Return Values

No value is returned.

Errors/Exceptions

Throws an Error if the underlying call to pthread_set_qos_class_self_np() fails.

See Also

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。