From c549d0f3411a2f9ed0e588f0470e9eb4c06bc4f6 Mon Sep 17 00:00:00 2001 From: thomasbeaujean Date: Tue, 17 Sep 2024 11:20:22 +0200 Subject: [PATCH] Use Coroutine::list instead of Coroutine::listCoroutines (#294) --- src/Context/Swoole/src/SwooleContextHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Context/Swoole/src/SwooleContextHandler.php b/src/Context/Swoole/src/SwooleContextHandler.php index d7bc3eca..87eba6df 100644 --- a/src/Context/Swoole/src/SwooleContextHandler.php +++ b/src/Context/Swoole/src/SwooleContextHandler.php @@ -41,7 +41,7 @@ public function switchToActiveCoroutine(): void public function splitOffChildCoroutines(): void { $pcid = Coroutine::getCid(); - foreach (Coroutine::listCoroutines() as $cid) { + foreach (method_exists(Coroutine::class, 'list') ? Coroutine::list() : Coroutine::listCoroutines() as $cid) { if ($pcid === Coroutine::getPcid($cid) && !$this->isForked($cid)) { $this->forkCoroutine($cid); }