OpenSwoole\Coroutine::enableScheduler()

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Coroutine::enableScheduler()

Parameters

Return

cid

Current coroutine ID.

Description

Enable preemptive scheduler.

It is the same as ini_set("swoole.enable_preemptive_scheduler", "1");.

Example

<?php
Swoole\Coroutine::enableScheduler();
co::run(function () {
    //
});
Last updated on September 1, 2022