OpenSwoole\Process\Pool->shutdown()

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php int OpenSwoole\Process\Pool->shutdown()

Parameters

Return

Description

Shutdown a process pool.

Example

<?php
$workerNum = 10;
$pool = new OpenSwoole\Process\Pool($workerNum);

$pool->on("WorkerStart", function ($pool, $workerId) {
    $process = $pool->getProcess();
    $process->exec("/bin/sh", ["ls", '-l']);
    $process->shutdown();
});

$pool->on("WorkerStop", function ($pool, $workerId) {
    echo "Worker#{$workerId} is stopped\n";
});

$pool->start();
Last updated on September 1, 2022