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

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

Set the QoS class.

### 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

- pcntl_getqos_class() - Get the QoS class of the current thread
- Pcntl\QosClass

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open