xref: /libuv/docs/src/prepare.rst (revision 25368e2d)
1
2.. _prepare:
3
4:c:type:`uv_prepare_t` --- Prepare handle
5=========================================
6
7Prepare handles will run the given callback once per loop iteration, right
8before polling for i/o.
9
10
11Data types
12----------
13
14.. c:type:: uv_prepare_t
15
16    Prepare handle type.
17
18.. c:type:: void (*uv_prepare_cb)(uv_prepare_t* handle)
19
20    Type definition for callback passed to :c:func:`uv_prepare_start`.
21
22
23Public members
24^^^^^^^^^^^^^^
25
26N/A
27
28.. seealso:: The :c:type:`uv_handle_t` members also apply.
29
30
31API
32---
33
34.. c:function:: int uv_prepare_init(uv_loop_t* loop, uv_prepare_t* prepare)
35
36    Initialize the handle. This function always succeeds.
37
38    :returns: 0
39
40.. c:function:: int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb)
41
42    Start the handle with the given callback. This function always succeeds,
43    except when `cb` is `NULL`.
44
45    :returns: 0 on success, or `UV_EINVAL` when `cb == NULL`.
46
47.. c:function:: int uv_prepare_stop(uv_prepare_t* prepare)
48
49    Stop the handle, the callback will no longer be called.
50    This function always succeeds.
51
52    :returns: 0
53
54.. seealso:: The :c:type:`uv_handle_t` API functions also apply.
55