#include <icy/idler.h>Inherits:
Runner
Asynchronous type that triggers callbacks when the event loop is idle.
This class inherits the [Runner](icy-Runner.html#runner) interface and may be used with any implementation that's powered by an asynchronous [Runner](icy-Runner.html#runner).
| Return | Name | Description |
|---|---|---|
Idler | Create the idler bound to loop without starting it. | |
Idler inline explicit | Create and immediately start the idler on the default loop. | |
Idler inline explicit | Create and immediately start the idler on the given loop. | |
void | start inline | Start the idler, invoking func (with args) on every idle iteration. |
void | start virtual | Start the idler with a type-erased callback (implements [Runner::start](icy-Runner.html#start-3)). |
uv::Handle< uv_idle_t > & | handle | #### Returns |
Idler(uv::Loop * loop)Create the idler bound to loop without starting it.
loop Event loop to associate with. Defaults to the process-wide default loop.inline explicit
template<typename Function, typename... Args> inline explicit Idler(Function && func, Args &&... args)Create and immediately start the idler on the default loop.
func Callable invoked on every idle iteration.
args Arguments forwarded to func.
inline explicit
template<typename Function, typename... Args> inline explicit Idler(uv::Loop * loop, Function && func, Args &&... args)Create and immediately start the idler on the given loop.
loop Event loop to associate with.
func Callable invoked on every idle iteration.
args Arguments forwarded to func.
inline
template<typename Function, typename... Args> inline void start(Function && func, Args &&... args)Start the idler, invoking func (with args) on every idle iteration.
The idler always runs in repeating mode; cancel via [Runner::cancel()](icy-Runner.html#cancel-2). Throws std::logic_error if the handle is already active or the runner context reports it is still running.
func Callable invoked each time the event loop is idle.
args Arguments forwarded to func on each invocation.
virtual
virtual void start(std::function< void()> func)Start the idler with a type-erased callback (implements [Runner::start](icy-Runner.html#start-3)).
func Callback invoked on every idle iteration.uv::Handle< uv_idle_t > & handle()Reference to the underlying uv_idle_t handle wrapper.
| Return | Name | Description |
|---|---|---|
uv::Handle< uv_idle_t > | _handle |
uv::Handle< uv_idle_t > _handle| Return | Name | Description |
|---|---|---|
void | init virtual | Initialize the underlying uv_idle_t handle and unref it from the loop. |
bool | async virtual const | #### Returns |
virtual
virtual void init()Initialize the underlying uv_idle_t handle and unref it from the loop.
virtual const
virtual bool async() constfalse; the idler is event-loop-driven, not thread-based.