function Driver::repeat
Repeatedly execute a callback.
The interval between executions 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 first execution is scheduled after the first interval period.
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 $interval The time interval, in seconds, to wait between executions.:
\Closure(string):void $closure The callback to repeat.:
Return value
string A unique identifier that can be used to cancel, enable or disable the callback.
2 methods override Driver::repeat()
- AbstractDriver::repeat in vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php - Repeatedly execute a callback.
- TracingDriver::repeat in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ TracingDriver.php - Repeatedly execute a callback.
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Driver.php, line 114
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 repeat(float $interval, \Closure $closure) : string;