savin/pcntl

此包已废弃,不再维护。未建议替代包。

Laravel 包,用于处理操作系统信号。

dev-master 2019-03-18 11:08 UTC

This package is auto-updated.

Last update: 2021-06-18 16:44:05 UTC


README

Laravel 包,用于处理操作系统信号。

安装

通过 Composer

$ composer require savin/pcntl

用法

$pcnl = PCNTL::create([SIGINT, SIGTERM, SIGHUP]);

while (true) {
    if ($pcnl->dispatch()->getLastSigno()) break;
}

echo $pcnl->getLastMessage();
$terminate = false;

$pcnl = PCNTL::create([SIGINT, SIGTERM], function($signal) use(&$terminate) {
    $terminate = $signal;
});

while (!$terminate) {
    $pcnl->dispatch();
}