Lines Matching refs:loop
69 static void uv__async_send(uv_loop_t* loop);
70 static int uv__async_start(uv_loop_t* loop);
74 int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) { in uv_async_init() argument
77 err = uv__async_start(loop); in uv_async_init()
81 uv__handle_init(loop, (uv_handle_t*)handle, UV_ASYNC); in uv_async_init()
86 uv__queue_insert_tail(&loop->async_handles, &handle->queue); in uv_async_init()
109 uv__async_send(handle->loop); in uv_async_send()
160 static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { argument
168 assert(w == &loop->async_io_watcher);
192 uv__queue_move(&loop->async_handles, &queue);
198 uv__queue_insert_tail(&loop->async_handles, q);
213 static void uv__async_send(uv_loop_t* loop) { argument
221 fd = loop->async_wfd;
228 fd = loop->async_io_watcher.fd; /* eventfd */
234 fd = loop->async_io_watcher.fd; /* magic number for EVFILT_USER */
236 r = kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL);
258 static int uv__async_start(uv_loop_t* loop) { argument
265 if (loop->async_io_watcher.fd != -1)
297 err = kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL);
311 uv__io_init(&loop->async_io_watcher, uv__async_io, pipefd[0]);
312 uv__io_start(loop, &loop->async_io_watcher, POLLIN);
313 loop->async_wfd = pipefd[1];
319 loop->async_io_watcher.events = loop->async_io_watcher.pevents;
326 void uv__async_stop(uv_loop_t* loop) { argument
331 if (loop->async_io_watcher.fd == -1)
337 uv__queue_move(&loop->async_handles, &queue);
343 uv__queue_insert_tail(&loop->async_handles, q);
348 if (loop->async_wfd != -1) {
349 if (loop->async_wfd != loop->async_io_watcher.fd)
350 uv__close(loop->async_wfd);
351 loop->async_wfd = -1;
354 uv__io_stop(loop, &loop->async_io_watcher, POLLIN);
355 uv__close(loop->async_io_watcher.fd);
356 loop->async_io_watcher.fd = -1;
360 int uv__async_fork(uv_loop_t* loop) { argument
365 if (loop->async_io_watcher.fd == -1) /* never started */
368 uv__queue_move(&loop->async_handles, &queue);
374 uv__queue_insert_tail(&loop->async_handles, q);
388 if (loop->async_wfd != -1) {
389 if (loop->async_wfd != loop->async_io_watcher.fd)
390 uv__close(loop->async_wfd);
391 loop->async_wfd = -1;
394 uv__io_stop(loop, &loop->async_io_watcher, POLLIN);
395 uv__close(loop->async_io_watcher.fd);
396 loop->async_io_watcher.fd = -1;
398 return uv__async_start(loop);