Lines Matching refs:handle
32 #define DECREASE_ACTIVE_COUNT(loop, handle) \ argument
34 if (--(handle)->activecnt == 0 && \
35 !((handle)->flags & UV_HANDLE_CLOSING)) { \
36 uv__handle_stop((handle)); \
38 assert((handle)->activecnt >= 0); \
42 #define INCREASE_ACTIVE_COUNT(loop, handle) \ argument
44 if ((handle)->activecnt++ == 0) { \
45 uv__handle_start((handle)); \
47 assert((handle)->activecnt > 0); \
51 #define DECREASE_PENDING_REQ_COUNT(handle) \ argument
53 assert(handle->reqs_pending > 0); \
54 handle->reqs_pending--; \
56 if (handle->flags & UV_HANDLE_CLOSING && \
57 handle->reqs_pending == 0) { \
58 uv__want_endgame(loop, (uv_handle_t*)handle); \
63 #define uv__handle_closing(handle) \ argument
65 assert(!((handle)->flags & UV_HANDLE_CLOSING)); \
67 if (!(((handle)->flags & UV_HANDLE_ACTIVE) && \
68 ((handle)->flags & UV_HANDLE_REF))) \
69 uv__active_handle_add((uv_handle_t*) (handle)); \
71 (handle)->flags |= UV_HANDLE_CLOSING; \
72 (handle)->flags &= ~UV_HANDLE_ACTIVE; \
76 #define uv__handle_close(handle) \ argument
78 uv__queue_remove(&(handle)->handle_queue); \
79 uv__active_handle_rm((uv_handle_t*) (handle)); \
81 (handle)->flags |= UV_HANDLE_CLOSED; \
83 if ((handle)->close_cb) \
84 (handle)->close_cb((uv_handle_t*) (handle)); \
88 INLINE static void uv__want_endgame(uv_loop_t* loop, uv_handle_t* handle) { in uv__want_endgame() argument
89 if (!(handle->flags & UV_HANDLE_ENDGAME_QUEUED)) { in uv__want_endgame()
90 handle->flags |= UV_HANDLE_ENDGAME_QUEUED; in uv__want_endgame()
92 handle->endgame_next = loop->endgame_handles; in uv__want_endgame()
93 loop->endgame_handles = handle; in uv__want_endgame()
99 uv_handle_t* handle; in uv__process_endgames() local
102 handle = loop->endgame_handles; in uv__process_endgames()
103 loop->endgame_handles = handle->endgame_next; in uv__process_endgames()
105 handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED; in uv__process_endgames()
107 switch (handle->type) { in uv__process_endgames()
109 uv__tcp_endgame(loop, (uv_tcp_t*) handle); in uv__process_endgames()
113 uv__pipe_endgame(loop, (uv_pipe_t*) handle); in uv__process_endgames()
117 uv__tty_endgame(loop, (uv_tty_t*) handle); in uv__process_endgames()
121 uv__udp_endgame(loop, (uv_udp_t*) handle); in uv__process_endgames()
125 uv__poll_endgame(loop, (uv_poll_t*) handle); in uv__process_endgames()
129 uv__timer_close((uv_timer_t*) handle); in uv__process_endgames()
130 uv__handle_close(handle); in uv__process_endgames()
136 uv__loop_watcher_endgame(loop, handle); in uv__process_endgames()
140 uv__async_endgame(loop, (uv_async_t*) handle); in uv__process_endgames()
144 uv__signal_endgame(loop, (uv_signal_t*) handle); in uv__process_endgames()
148 uv__process_endgame(loop, (uv_process_t*) handle); in uv__process_endgames()
152 uv__fs_event_endgame(loop, (uv_fs_event_t*) handle); in uv__process_endgames()
156 uv__fs_poll_endgame(loop, (uv_fs_poll_t*) handle); in uv__process_endgames()
173 HANDLE handle; in uv__get_osfhandle() local
175 handle = (HANDLE) _get_osfhandle(fd); in uv__get_osfhandle()
177 return handle; in uv__get_osfhandle()