Swoole\Coroutine\System::wait(float $timeout = -1): int | false

Declaration

<?php
Swoole\Coroutine\System::wait(float $timeout = -1): int | false

Parameters

timeout

Waiting timeout.

Return

Description

Wait for the I/O event witin coroutine context.

Example

<?php
(new Swoole\Process(function () {
    echo "child process start\n";
    sleep(1);
    echo "child process exit\n";
}))->start();

Co\run(function () {
    $info = Swoole\Coroutine\System::wait(5);
    var_dump($info);
});