Lines Matching refs:handle
36 uv_signal_t* handle; member
44 static int uv__signal_start(uv_signal_t* handle,
50 static void uv__signal_stop(uv_signal_t* handle);
168 uv_signal_t* handle; in uv__signal_first_handle() local
174 handle = RB_NFIND(uv__signal_tree_s, &uv__signal_tree, &lookup); in uv__signal_first_handle()
176 if (handle != NULL && handle->signum == signum) in uv__signal_first_handle()
177 return handle; in uv__signal_first_handle()
185 uv_signal_t* handle; in uv__signal_handler() local
196 for (handle = uv__signal_first_handle(signum); in uv__signal_handler()
197 handle != NULL && handle->signum == signum; in uv__signal_handler()
198 handle = RB_NEXT(uv__signal_tree_s, handle)) { in uv__signal_handler()
202 msg.handle = handle; in uv__signal_handler()
209 r = write(handle->loop->signal_pipefd[1], &msg, sizeof msg); in uv__signal_handler()
216 handle->caught_signals++; in uv__signal_handler()
293 uv_handle_t* handle = uv__queue_data(q, uv_handle_t, handle_queue); in uv__signal_loop_fork() local
296 if (handle->type != UV_SIGNAL) in uv__signal_loop_fork()
299 sh = (uv_signal_t*) handle; in uv__signal_loop_fork()
318 uv_handle_t* handle = uv__queue_data(q, uv_handle_t, handle_queue); in uv__signal_loop_cleanup() local
320 if (handle->type == UV_SIGNAL) in uv__signal_loop_cleanup()
321 uv__signal_stop((uv_signal_t*) handle); in uv__signal_loop_cleanup()
336 int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle) { in uv_signal_init() argument
343 uv__handle_init(loop, (uv_handle_t*) handle, UV_SIGNAL); in uv_signal_init()
344 handle->signum = 0; in uv_signal_init()
345 handle->caught_signals = 0; in uv_signal_init()
346 handle->dispatched_signals = 0; in uv_signal_init()
352 void uv__signal_close(uv_signal_t* handle) { in uv__signal_close() argument
353 uv__signal_stop(handle); in uv__signal_close()
357 int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) { in uv_signal_start() argument
358 return uv__signal_start(handle, signal_cb, signum, 0); in uv_signal_start()
362 int uv_signal_start_oneshot(uv_signal_t* handle, in uv_signal_start_oneshot() argument
365 return uv__signal_start(handle, signal_cb, signum, 1); in uv_signal_start_oneshot()
369 static int uv__signal_start(uv_signal_t* handle, in uv__signal_start() argument
377 assert(!uv__is_closing(handle)); in uv__signal_start()
391 if (signum == handle->signum) { in uv__signal_start()
392 handle->signal_cb = signal_cb; in uv__signal_start()
397 if (handle->signum != 0) { in uv__signal_start()
398 uv__signal_stop(handle); in uv__signal_start()
418 handle->signum = signum; in uv__signal_start()
420 handle->flags |= UV_SIGNAL_ONE_SHOT; in uv__signal_start()
422 RB_INSERT(uv__signal_tree_s, &uv__signal_tree, handle); in uv__signal_start()
426 handle->signal_cb = signal_cb; in uv__signal_start()
427 uv__handle_start(handle); in uv__signal_start()
437 uv_signal_t* handle; in uv__signal_event() local
474 handle = msg->handle; in uv__signal_event()
476 if (msg->signum == handle->signum) { in uv__signal_event()
477 assert(!(handle->flags & UV_HANDLE_CLOSING)); in uv__signal_event()
478 handle->signal_cb(handle, handle->signum); in uv__signal_event()
481 handle->dispatched_signals++; in uv__signal_event()
483 if (handle->flags & UV_SIGNAL_ONE_SHOT) in uv__signal_event()
484 uv__signal_stop(handle); in uv__signal_event()
530 int uv_signal_stop(uv_signal_t* handle) { in uv_signal_stop() argument
531 assert(!uv__is_closing(handle)); in uv_signal_stop()
532 uv__signal_stop(handle); in uv_signal_stop()
537 static void uv__signal_stop(uv_signal_t* handle) { in uv__signal_stop() argument
546 if (handle->signum == 0) in uv__signal_stop()
551 removed_handle = RB_REMOVE(uv__signal_tree_s, &uv__signal_tree, handle); in uv__signal_stop()
552 assert(removed_handle == handle); in uv__signal_stop()
558 first_handle = uv__signal_first_handle(handle->signum); in uv__signal_stop()
560 uv__signal_unregister_handler(handle->signum); in uv__signal_stop()
562 rem_oneshot = handle->flags & UV_SIGNAL_ONE_SHOT; in uv__signal_stop()
565 ret = uv__signal_register_handler(handle->signum, 1); in uv__signal_stop()
573 handle->signum = 0; in uv__signal_stop()
574 uv__handle_stop(handle); in uv__signal_stop()