mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 00:25:35 +08:00
enhancement for process state
This commit is contained in:
@@ -8,7 +8,8 @@ use Swoole\Process;
|
||||
use ZM\Annotation\Swoole\SwooleHandler;
|
||||
use ZM\Console\Console;
|
||||
use ZM\Event\SwooleEvent;
|
||||
use ZM\Utils\DataProvider;
|
||||
use ZM\Framework;
|
||||
use ZM\Utils\Manager\ProcessManager;
|
||||
|
||||
/**
|
||||
* Class OnManagerStop
|
||||
@@ -17,15 +18,12 @@ use ZM\Utils\DataProvider;
|
||||
*/
|
||||
class OnManagerStop implements SwooleEvent
|
||||
{
|
||||
public function onCall() {
|
||||
if (OnManagerStart::$process !== null) {
|
||||
if (Process::kill(OnManagerStart::$process->pid, 0)) {
|
||||
Process::kill(OnManagerStart::$process->pid, SIGTERM);
|
||||
}
|
||||
public function onCall()
|
||||
{
|
||||
foreach (ProcessManager::$user_process as $v) {
|
||||
if (posix_getsid($v->pid) !== false) Process::kill($v->pid, SIGTERM);
|
||||
}
|
||||
Console::verbose("进程 Manager 已停止!");
|
||||
if (file_exists(DataProvider::getWorkingDir()."/.daemon_pid")) {
|
||||
unlink(DataProvider::getWorkingDir()."/.daemon_pid");
|
||||
}
|
||||
Framework::removeProcessState(ZM_PROCESS_MANAGER);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user