国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

請教workerman5.1版本協(xié)程問題

彭彭

問題描述

這里寫問題描述

在worker類文件中,只有onWorkerstart回調(diào)里調(diào)用Coroutine::create($callback);創(chuàng)建了協(xié)程,其他onMessage,onConnect,onClose方法并未看見創(chuàng)建協(xié)程來執(zhí)行,這是不是與文檔里的注意事項不符。謝謝社區(qū)大佬,答疑解惑,謝謝?。?!祝大家端午安康?。?!
public function run(): void
    {
        $this->listen();

        if (!$this->onWorkerStart) {
            return;
        }

        // Try to emit onWorkerStart callback.
        $callback = function() {
            try {
                ($this->onWorkerStart)($this);
            } catch (Throwable $e) {
                // Avoid rapid infinite loop exit.
                sleep(1);
                static::stopAll(250, $e);
            }
        };

        switch (Worker::$eventLoopClass) {
            case Swoole::class:
            case Swow::class:
            case Fiber::class:
                Coroutine::create($callback);
                break;
            default:
                (new \Fiber($callback))->start();
        }
    }
308 1 0
1個回答

walkor 打賞

onMessage,onConnect,onClose等協(xié)程創(chuàng)建是在 Events/Swoole.php Events/Swow.php Events/Fiber.php 中完成的。
onWorkerStart不歸Events管,所以單獨手動創(chuàng)建了一個協(xié)程去執(zhí)行。

??