Swoole\Process\Pool->shutdown()

Declaration

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

Parameters

Return

Description

Shutdown a process pool.

Example

<?php
$workerNum = 10;
$pool = new Swoole\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();