Idle handles will run the given callback once per loop iteration, right before the Prepare handle.
Note: The notable difference with prepare handles is that when there are active idle handles, the loop will perform a zero timeout poll instead of blocking for i/o.
Warning: Despite the name, idle handles will get their callbacks called on every loop iteration, not when the loop is actually “idle”.
Idle handle <libuv 1.10.3-dev API documentation>
See also The Handle API functions also apply.
Types
Idle = object loop* {.
importc: "loop".}: ptr Loop ## Pointer to the ``Loop`` where the handle is running on. Readonly. typ* {.importc: "type".}: HandleType ## The ``HandleType``. Readonly. data* {.importc: "data".}: pointer ## Space for user-defined arbitrary data. libuv does not use this field.- Idle handle type. Source Edit
IdleCb = proc (handle: ptr Idle) {.
cdecl.}- Type definition for callback passed to start(). Source Edit
Procs
proc init(loop: ptr Loop; handle: ptr Idle): cint {.
importc: "uv_idle_init", header: "uv.h".}- Initialize the handle. Source Edit
proc start(handle: ptr Idle; cb: IdleCb): cint {.
importc: "uv_idle_start", header: "uv.h".}- Start the handle with the given callback. Source Edit
proc stop(handle: ptr Idle): cint {.
importc: "uv_idle_stop", header: "uv.h".}- Stop the handle, the callback will no longer be called. Source Edit