Lines Matching defs:handle

58 int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
59 uv__handle_init(loop, (uv_handle_t*)handle, UV_TIMER);
60 handle->timer_cb = NULL;
61 handle->timeout = 0;
62 handle->repeat = 0;
67 int uv_timer_start(uv_timer_t* handle,
73 if (uv__is_closing(handle) || cb == NULL)
76 if (uv__is_active(handle))
77 uv_timer_stop(handle);
79 clamped_timeout = handle->loop->time + timeout;
83 handle->timer_cb = cb;
84 handle->timeout = clamped_timeout;
85 handle->repeat = repeat;
87 handle->start_id = handle->loop->timer_counter++;
89 heap_insert(timer_heap(handle->loop),
90 (struct heap_node*) &handle->heap_node,
92 uv__handle_start(handle);
98 int uv_timer_stop(uv_timer_t* handle) {
99 if (!uv__is_active(handle))
102 heap_remove(timer_heap(handle->loop),
103 (struct heap_node*) &handle->heap_node,
105 uv__handle_stop(handle);
111 int uv_timer_again(uv_timer_t* handle) {
112 if (handle->timer_cb == NULL)
115 if (handle->repeat) {
116 uv_timer_stop(handle);
117 uv_timer_start(handle, handle->timer_cb, handle->repeat, handle->repeat);
124 void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) {
125 handle->repeat = repeat;
129 uint64_t uv_timer_get_repeat(const uv_timer_t* handle) {
130 return handle->repeat;
134 uint64_t uv_timer_get_due_in(const uv_timer_t* handle) {
135 if (handle->loop->time >= handle->timeout)
138 return handle->timeout - handle->loop->time;
144 const uv_timer_t* handle;
151 handle = container_of(heap_node, uv_timer_t, heap_node);
152 if (handle->timeout <= loop->time)
155 diff = handle->timeout - loop->time;
165 uv_timer_t* handle;
172 handle = container_of(heap_node, uv_timer_t, heap_node);
173 if (handle->timeout > loop->time)
176 uv_timer_stop(handle);
177 uv_timer_again(handle);
178 handle->timer_cb(handle);
183 void uv__timer_close(uv_timer_t* handle) {
184 uv_timer_stop(handle);