From a94a87a12f8fc062ee02006b2dcb99f1c1b7f4b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=AF=BAEno?= <895183594@qq.com> Date: Wed, 17 Jul 2024 18:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=A8=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=85=B1=E4=BA=AB=E5=90=AF=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E6=9C=AA=E6=AD=A3=E5=B8=B8=E6=8C=82=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shared-memory/src/Process/SharedMemoryProcess.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Components/shared-memory/src/Process/SharedMemoryProcess.php b/src/Components/shared-memory/src/Process/SharedMemoryProcess.php index 48e2597a96..0d42d44f51 100644 --- a/src/Components/shared-memory/src/Process/SharedMemoryProcess.php +++ b/src/Components/shared-memory/src/Process/SharedMemoryProcess.php @@ -17,6 +17,10 @@ class SharedMemoryProcess extends BaseProcess { public function run(\Swoole\Process $process): void { + $running = true; + \Imi\Event\Event::on('IMI.PROCESS.END', static function () use (&$running) { + $running = false; + }, ImiPriority::IMI_MAX); $socketFile = Config::get('@app.swooleSharedMemory.socketFile'); if (null === $socketFile) { @@ -34,5 +38,10 @@ public function run(\Swoole\Process $process): void ]); $server->run(); fwrite(\STDOUT, 'Process [sharedMemory] start' . \PHP_EOL); + /** @phpstan-ignore-next-line */ + while ($running) + { + sleep(1); + } } }