Lines Matching refs:handle
37 int uv__signal_start(uv_signal_t* handle,
82 uv_signal_t* handle; in RB_GENERATE_STATIC() local
92 for (handle = RB_NFIND(uv_signal_tree_s, &uv__signal_tree, &lookup); in RB_GENERATE_STATIC()
93 handle != NULL && handle->signum == signum; in RB_GENERATE_STATIC()
94 handle = RB_NEXT(uv_signal_tree_s, handle)) { in RB_GENERATE_STATIC()
96 (volatile LONG*) &handle->pending_signum, signum); in RB_GENERATE_STATIC()
98 if (handle->flags & UV_SIGNAL_ONE_SHOT_DISPATCHED) in RB_GENERATE_STATIC()
102 POST_COMPLETION_FOR_REQ(handle->loop, &handle->signal_req); in RB_GENERATE_STATIC()
106 if (handle->flags & UV_SIGNAL_ONE_SHOT) in RB_GENERATE_STATIC()
107 handle->flags |= UV_SIGNAL_ONE_SHOT_DISPATCHED; in RB_GENERATE_STATIC()
147 int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle) { in uv_signal_init() argument
148 uv__handle_init(loop, (uv_handle_t*) handle, UV_SIGNAL); in uv_signal_init()
149 handle->pending_signum = 0; in uv_signal_init()
150 handle->signum = 0; in uv_signal_init()
151 handle->signal_cb = NULL; in uv_signal_init()
153 UV_REQ_INIT(&handle->signal_req, UV_SIGNAL_REQ); in uv_signal_init()
154 handle->signal_req.data = handle; in uv_signal_init()
160 int uv_signal_stop(uv_signal_t* handle) { in uv_signal_stop() argument
164 if (handle->signum == 0) in uv_signal_stop()
169 removed_handle = RB_REMOVE(uv_signal_tree_s, &uv__signal_tree, handle); in uv_signal_stop()
170 assert(removed_handle == handle); in uv_signal_stop()
174 handle->signum = 0; in uv_signal_stop()
175 uv__handle_stop(handle); in uv_signal_stop()
181 int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) { in uv_signal_start() argument
182 return uv__signal_start(handle, signal_cb, signum, 0); in uv_signal_start()
186 int uv_signal_start_oneshot(uv_signal_t* handle, in uv_signal_start_oneshot() argument
189 return uv__signal_start(handle, signal_cb, signum, 1); in uv_signal_start_oneshot()
193 int uv__signal_start(uv_signal_t* handle, in uv__signal_start() argument
205 if (signum == handle->signum) { in uv__signal_start()
206 handle->signal_cb = signal_cb; in uv__signal_start()
211 if (handle->signum != 0) { in uv__signal_start()
212 int r = uv_signal_stop(handle); in uv__signal_start()
219 handle->signum = signum; in uv__signal_start()
221 handle->flags |= UV_SIGNAL_ONE_SHOT; in uv__signal_start()
223 RB_INSERT(uv_signal_tree_s, &uv__signal_tree, handle); in uv__signal_start()
227 handle->signal_cb = signal_cb; in uv__signal_start()
228 uv__handle_start(handle); in uv__signal_start()
234 void uv__process_signal_req(uv_loop_t* loop, uv_signal_t* handle, in uv__process_signal_req() argument
238 assert(handle->type == UV_SIGNAL); in uv__process_signal_req()
242 (volatile LONG*) &handle->pending_signum, 0); in uv__process_signal_req()
248 if (dispatched_signum == handle->signum) in uv__process_signal_req()
249 handle->signal_cb(handle, dispatched_signum); in uv__process_signal_req()
251 if (handle->flags & UV_SIGNAL_ONE_SHOT) in uv__process_signal_req()
252 uv_signal_stop(handle); in uv__process_signal_req()
254 if (handle->flags & UV_HANDLE_CLOSING) { in uv__process_signal_req()
256 assert(handle->signum == 0); in uv__process_signal_req()
257 uv__want_endgame(loop, (uv_handle_t*) handle); in uv__process_signal_req()
262 void uv__signal_close(uv_loop_t* loop, uv_signal_t* handle) { in uv__signal_close() argument
263 uv_signal_stop(handle); in uv__signal_close()
264 uv__handle_closing(handle); in uv__signal_close()
266 if (handle->pending_signum == 0) { in uv__signal_close()
267 uv__want_endgame(loop, (uv_handle_t*) handle); in uv__signal_close()
272 void uv__signal_endgame(uv_loop_t* loop, uv_signal_t* handle) { in uv__signal_endgame() argument
273 assert(handle->flags & UV_HANDLE_CLOSING); in uv__signal_endgame()
274 assert(!(handle->flags & UV_HANDLE_CLOSED)); in uv__signal_endgame()
276 assert(handle->signum == 0); in uv__signal_endgame()
277 assert(handle->pending_signum == 0); in uv__signal_endgame()
279 handle->flags |= UV_HANDLE_CLOSED; in uv__signal_endgame()
281 uv__handle_close(handle); in uv__signal_endgame()