Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Timer::set(array $timerSettings)\:\ void
true
: Enable coroutine support within a timer callableif successful, it returns true
if the operation failed, it returns false
Set the runtime settings for Timer callables. The settings can be accessed by OpenSwoole\Timer::setting
.
<?php
OpenSwoole\Timer::set([
'enable_coroutine' => true,
]);
var_dump(OpenSwoole\Timer::setting);
You can use the set
method to enable full coroutine support within a timer context, it will automatically create a coroutine context for you so you don't need to create the initial go()
context when a timer runs.