|
160
|
1
|
|
|
2 .. _idle:
|
|
|
3
|
|
|
4 :c:type:`uv_idle_t` --- Idle handle
|
|
|
5 ===================================
|
|
|
6
|
|
|
7 Idle handles will run the given callback once per loop iteration, right
|
|
|
8 before the :c:type:`uv_prepare_t` handles.
|
|
|
9
|
|
|
10 .. note::
|
|
|
11 The notable difference with prepare handles is that when there are active idle handles,
|
|
|
12 the loop will perform a zero timeout poll instead of blocking for i/o.
|
|
|
13
|
|
|
14 .. warning::
|
|
|
15 Despite the name, idle handles will get their callbacks called on every loop iteration,
|
|
|
16 not when the loop is actually "idle".
|
|
|
17
|
|
|
18
|
|
|
19 Data types
|
|
|
20 ----------
|
|
|
21
|
|
|
22 .. c:type:: uv_idle_t
|
|
|
23
|
|
|
24 Idle handle type.
|
|
|
25
|
|
|
26 .. c:type:: void (*uv_idle_cb)(uv_idle_t* handle)
|
|
|
27
|
|
|
28 Type definition for callback passed to :c:func:`uv_idle_start`.
|
|
|
29
|
|
|
30
|
|
|
31 Public members
|
|
|
32 ^^^^^^^^^^^^^^
|
|
|
33
|
|
|
34 N/A
|
|
|
35
|
|
|
36 .. seealso:: The :c:type:`uv_handle_t` members also apply.
|
|
|
37
|
|
|
38
|
|
|
39 API
|
|
|
40 ---
|
|
|
41
|
|
|
42 .. c:function:: int uv_idle_init(uv_loop_t* loop, uv_idle_t* idle)
|
|
|
43
|
|
|
44 Initialize the handle. This function always succeeds.
|
|
|
45
|
|
|
46 :returns: 0
|
|
|
47
|
|
|
48 .. c:function:: int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb)
|
|
|
49
|
|
|
50 Start the handle with the given callback. This function always succeeds,
|
|
|
51 except when `cb` is `NULL`.
|
|
|
52
|
|
|
53 :returns: 0 on success, or `UV_EINVAL` when `cb == NULL`.
|
|
|
54
|
|
|
55 .. c:function:: int uv_idle_stop(uv_idle_t* idle)
|
|
|
56
|
|
|
57 Stop the handle, the callback will no longer be called.
|
|
|
58 This function always succeeds.
|
|
|
59
|
|
|
60 :returns: 0
|
|
|
61
|
|
|
62 .. seealso:: The :c:type:`uv_handle_t` API functions also apply.
|