OpenSwoole\Process::setaffinity(array $cpu_set) : bool

25.x is outdated, please check the latest version 26.x


Latest version: pecl install openswoole-26.2.0

Declaration

<?php OpenSwoole\Process::setaffinity(array $cpu_set) : bool

Parameters

cpu_set

The array of cpu number. Use swoole_CPU_NUM to get the number of cpu. For example: array(0,2,3) stands for CPU0/CPU2/CPU3

Return

success

Description

Set the CPU affinity of the process.

Example

Last updated on February 28, 2026