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

Declaration

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

Parameters

signo

Linux singal number.

pid

Linux process ID.

Return

Description

Waiting for system signal within Coroutine.

Example

<?php

$pid = getmypid();

$process = new Swoole\Process(function () use ($pid) {
    echo "child process start\n";
    sleep(1);
    Process::kill($pid, SIGUSR1);
    echo "child process exit\n";
});
$process->start();

Co\run(function () {
    $info = Swoole\Coroutine\System::waitSignal(SIGUSR1, 3);
    var_dump($info);
});