Process Manager

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Execute your function with multiple processes managed by the process manager.

Swoole\Process\ProcessManager is an alias of Swoole\Process\Manager.

since v4.5.3

Methods

Example

<?php
$pm = new Swoole\Process\Manager();
$atomic = new Atomic(0);
$pm->add(function (Pool $pool, int $workerId) use ($atomic) {
    usleep(100000);
    $atomic->wakeup();
});
$pm->add(function (Pool $pool, int $workerId) use ($atomic) {
    $atomic->wait(1.5);
    $pool->shutdown();
});
$pm->start();
Last updated on August 31, 2022