Event::idle#
An idle watcher: an event when the loop has nothing else to do - no event queued, nothing arriving. min keeps it from firing more often than every so many seconds, and max makes it fire after that many seconds even if the loop never goes idle.
Event->idle(%attributes) (or Event::idle->new(...)) takes the shared attributes of Event::Watcher and the ones below. Given min or max, the watcher repeats; otherwise it fires once. repeat overrides either.
Event::all_idle lists the idle watchers waiting for the loop to go idle.
Synopsis#
use Event;
Event->idle(min => 1, max => 10, cb => sub { flush_caches() });
Event::loop();
Functions#
Attributes#
hard#
How the waiting time is reckoned when the watcher starts again after its callback: when true from the time the callback was called, when false (the default) from the time it returned.
max#
The most seconds to wait for the loop to go idle; after that the watcher fires anyway, as an ordinary event at its priority. A number, a reference to a number, or undef (the default) for no limit.
min#
The fewest seconds between two events of this watcher: it starts waiting for idleness only that long after it was started or its callback ran. A number, a reference to a number, or undef for no minimum; 0.01 by default.