Swoole\Coroutine::enableScheduler()

Declaration

<?php
Swoole\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 () {
    // 
});