From f4fbb045257de877e7813f185912131675f43f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 1 Sep 2020 15:01:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-server/ServerManager.php | 3 ++- system/Process/Process.php | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/http-server/ServerManager.php b/http-server/ServerManager.php index eb33d800..719bf633 100644 --- a/http-server/ServerManager.php +++ b/http-server/ServerManager.php @@ -68,9 +68,10 @@ class ServerManager */ protected static function createProcess($process, $application, $pool, $workerId) { + $application->set($pool->getProcess($workerId)); $process = new $process($application); $application->debug(sprintf('Worker #%d is running.', $workerId)); - return $process->start($pool->getProcess($workerId)); + return $process->start(); } diff --git a/system/Process/Process.php b/system/Process/Process.php index e0560b02..6519fdf1 100644 --- a/system/Process/Process.php +++ b/system/Process/Process.php @@ -38,13 +38,11 @@ abstract class Process extends Component /** - * @param $process */ - protected function start($process) + protected function start() { - do { - $this->onHandler($process); - } while (true); + $_process = new \Swoole\Process([$this, 'onHandler'], false, null, true); + $_process->start(); } }