Lines Matching refs:handle
32 #define DECREASE_ACTIVE_COUNT(loop, handle) \
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) \
44 if ((handle)->activecnt++ == 0) { \
45 uv__handle_start((handle)); \
47 assert((handle)->activecnt > 0); \
51 #define DECREASE_PENDING_REQ_COUNT(handle) \
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) \
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) \
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) {
89 if (!(handle->flags & UV_HANDLE_ENDGAME_QUEUED)) {
90 handle->flags |= UV_HANDLE_ENDGAME_QUEUED;
92 handle->endgame_next = loop->endgame_handles;
93 loop->endgame_handles = handle;
99 uv_handle_t* handle;
102 handle = loop->endgame_handles;
103 loop->endgame_handles = handle->endgame_next;
105 handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED;
107 switch (handle->type) {
109 uv__tcp_endgame(loop, (uv_tcp_t*) handle);
113 uv__pipe_endgame(loop, (uv_pipe_t*) handle);
117 uv__tty_endgame(loop, (uv_tty_t*) handle);
121 uv__udp_endgame(loop, (uv_udp_t*) handle);
125 uv__poll_endgame(loop, (uv_poll_t*) handle);
129 uv__timer_close((uv_timer_t*) handle);
130 uv__handle_close(handle);
136 uv__loop_watcher_endgame(loop, handle);
140 uv__async_endgame(loop, (uv_async_t*) handle);
144 uv__signal_endgame(loop, (uv_signal_t*) handle);
148 uv__process_endgame(loop, (uv_process_t*) handle);
152 uv__fs_event_endgame(loop, (uv_fs_event_t*) handle);
156 uv__fs_poll_endgame(loop, (uv_fs_poll_t*) handle);
173 HANDLE handle;
175 handle = (HANDLE) _get_osfhandle(fd);
177 return handle;