Swoole\Timer::clearAll

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Timer::clearAll()\:\ bool

Parameters

none

Return

success

if success, it returns true

fail

if it fails false will be returned

Description

Clear all the current timers within the same process space.

Basically the same as Swoole\Timer::clear but it clears all active timers at once.

Swoole >= v4.4.0 is required

Example

<?php

Swoole\Timer::tick(3000, function () {
    echo "after 3000ms.\n";
});

$str = "Swoole";
Swoole\Timer::after(5000, function() use ($str) {
    echo "Hello, $str\n";
});

// Stop all timers
Swoole\Timer::clearAll();
Last updated on August 31, 2022