Files
zhamao-framework/src/ZM/Event/SwooleEvent/OnManagerStop.php

27 lines
601 B
PHP
Raw Normal View History

<?php
namespace ZM\Event\SwooleEvent;
2021-07-09 01:38:30 +08:00
use Swoole\Process;
use ZM\Annotation\Swoole\SwooleHandler;
use ZM\Console\Console;
use ZM\Event\SwooleEvent;
/**
* Class OnManagerStop
* @package ZM\Event\SwooleEvent
* @SwooleHandler("ManagerStop")
*/
class OnManagerStop implements SwooleEvent
{
public function onCall() {
2021-07-09 01:38:30 +08:00
if (OnManagerStart::$process !== null) {
if (Process::kill(OnManagerStart::$process->pid, 0)) {
Process::kill(OnManagerStart::$process->pid, SIGTERM);
}
}
Console::verbose("进程 Manager 已停止!");
}
}