This commit is contained in:
as2252258@163.com
2021-04-23 03:55:51 +08:00
parent 93ca2318bd
commit 60b30d2557
3 changed files with 108 additions and 66 deletions
+8 -3
View File
@@ -7,11 +7,8 @@ namespace Snowflake\Process;
use Exception;
use JetBrains\PhpStorm\Pure;
use Snowflake\Application;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake;
use Swoole\Coroutine\System;
/**
* Class Process
@@ -46,6 +43,14 @@ abstract class Process extends \Swoole\Process implements SProcess
if (Snowflake::getPlatform()->isLinux()) {
name($process->pid, $this->getPrefix());
}
if (method_exists($this, 'before')) {
$this->before($process);
}
if (!Snowflake::getPlatform()->isMac()) {
if (method_exists($this, 'getProcessName')) {
swoole_set_process_name($this->getProcessName());
}
}
$this->onHandler($process);
}
+9 -4
View File
@@ -8,9 +8,14 @@ interface SProcess
{
/**
* @param \Swoole\Process $process
*/
public function onHandler(\Swoole\Process $process): void;
// public function getProcessName(): string;
//
//
// public function before(\Swoole\Process $process): void;
/**
* @param \Swoole\Process $process
*/
public function onHandler(\Swoole\Process $process): void;
}