function Driver::delay
Delay the execution of a callback.
The delay is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be determined by which timers expire first, but timers with the same expiration time MAY be executed in any order.
The created callback MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) right before the next tick. Callbacks MUST NOT be called in the tick they were enabled.
Parameters
float $delay The amount of time, in seconds, to delay the execution for.:
\Closure(string):void $closure The callback to delay. The `$callbackId` will be invalidated before the: callback invocation.
Return value
string A unique identifier that can be used to cancel, enable or disable the callback.
2 methods override Driver::delay()
- AbstractDriver::delay in vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php - Delay the execution of a callback.
- TracingDriver::delay in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ TracingDriver.php - Delay the execution of a callback.
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Driver.php, line 97
Class
- Driver
- The driver MUST run in its own fiber and execute callbacks in a separate fiber. If fibers are reused, the driver needs to call {
Namespace
Revolt\EventLoopCode
public function delay(float $delay, \Closure $closure) : string;