Idler
Idler
#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).
Public Methods
| 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
Idler(uv::Loop * loop)Create the idler bound to loop without starting it.
Parameters
loopEvent loop to associate with. Defaults to the process-wide default loop.
Idler
inline explicit
template<typename Function, typename... Args> inline explicit Idler(Function && func, Args &&... args)Create and immediately start the idler on the default loop.
Parameters
funcCallable invoked on every idle iteration.argsArguments forwarded tofunc.
Idler
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.
Parameters
loopEvent loop to associate with.funcCallable invoked on every idle iteration.argsArguments forwarded tofunc.
start
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.
Parameters
funcCallable invoked each time the event loop is idle.argsArguments forwarded tofuncon each invocation.
start
virtual
virtual void start(std::function< void()> func)Start the idler with a type-erased callback (implements [Runner::start](icy-Runner.html#start-3)).
Parameters
funcCallback invoked on every idle iteration.
handle
uv::Handle< uv_idle_t > & handle()Returns
Reference to the underlying uv_idle_t handle wrapper.
Protected Attributes
| Return | Name | Description |
|---|---|---|
uv::Handle< uv_idle_t > | _handle |
_handle
uv::Handle< uv_idle_t > _handleProtected Methods
| Return | Name | Description |
|---|---|---|
void | init virtual | Initialize the underlying uv_idle_t handle and unref it from the loop. |
bool | async virtual const | #### Returns |
init
virtual
virtual void init()Initialize the underlying uv_idle_t handle and unref it from the loop.
async
virtual const
virtual bool async() constReturns
false; the idler is event-loop-driven, not thread-based.
