Lines Matching refs:loop
51 static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags);
54 int uv__kqueue_init(uv_loop_t* loop) { in uv__kqueue_init() argument
55 loop->backend_fd = kqueue(); in uv__kqueue_init()
56 if (loop->backend_fd == -1) in uv__kqueue_init()
59 uv__cloexec(loop->backend_fd, 1); in uv__kqueue_init()
69 int uv__io_fork(uv_loop_t* loop) { in uv__io_fork() argument
71 loop->backend_fd = -1; in uv__io_fork()
72 err = uv__kqueue_init(loop); in uv__io_fork()
77 if (loop->cf_state != NULL) { in uv__io_fork()
91 uv__free(loop->cf_state); in uv__io_fork()
92 loop->cf_state = NULL; in uv__io_fork()
99 int uv__io_check_fd(uv_loop_t* loop, int fd) { in uv__io_check_fd() argument
137 if (kevent(loop->backend_fd, ev, 2, NULL, 0, NULL)) in uv__io_check_fd()
159 void uv__io_poll(uv_loop_t* loop, int timeout) { in uv__io_poll() argument
184 if (loop->nfds == 0) { in uv__io_poll()
185 assert(uv__queue_empty(&loop->watcher_queue)); in uv__io_poll()
189 lfields = uv__get_internal_fields(loop); in uv__io_poll()
192 while (!uv__queue_empty(&loop->watcher_queue)) { in uv__io_poll()
193 q = uv__queue_head(&loop->watcher_queue); in uv__io_poll()
200 assert(w->fd < (int) loop->nwatchers); in uv__io_poll()
217 if (kevent(loop->backend_fd, events, nevents, NULL, 0, NULL)) in uv__io_poll()
227 if (kevent(loop->backend_fd, events, nevents, NULL, 0, NULL)) in uv__io_poll()
237 if (kevent(loop->backend_fd, events, nevents, NULL, 0, NULL)) in uv__io_poll()
247 if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { in uv__io_poll()
254 base = loop->time; in uv__io_poll()
270 uv__metrics_set_provider_entry_time(loop); in uv__io_poll()
286 nfds = kevent(loop->backend_fd, in uv__io_poll()
306 uv__update_time(loop); in uv__io_poll()
311 if (loop->flags & UV_LOOP_REAP_CHILDREN) { in uv__io_poll()
312 loop->flags &= ~UV_LOOP_REAP_CHILDREN; in uv__io_poll()
313 uv__wait_children(loop); in uv__io_poll()
332 assert(loop->watchers != NULL); in uv__io_poll()
333 loop->watchers[loop->nwatchers] = (void*) events; in uv__io_poll()
334 loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; in uv__io_poll()
341 uv__queue_foreach(q, &loop->process_handles) { in uv__io_poll()
345 loop->flags |= UV_LOOP_REAP_CHILDREN; in uv__io_poll()
356 w = loop->watchers[fd]; in uv__io_poll()
360 uv__kqueue_delete(loop->backend_fd, ev); in uv__io_poll()
366 w = &loop->async_io_watcher; in uv__io_poll()
368 uv__metrics_update_idle_time(loop); in uv__io_poll()
369 w->cb(loop, w, w->events); in uv__io_poll()
378 uv__metrics_update_idle_time(loop); in uv__io_poll()
379 w->cb(loop, w, ev->fflags); /* XXX always uv__fs_event() */ in uv__io_poll()
390 uv__kqueue_delete(loop->backend_fd, ev); in uv__io_poll()
400 uv__kqueue_delete(loop->backend_fd, ev); in uv__io_poll()
407 uv__kqueue_delete(loop->backend_fd, ev); in uv__io_poll()
419 if (w == &loop->signal_io_watcher) { in uv__io_poll()
422 uv__metrics_update_idle_time(loop); in uv__io_poll()
423 w->cb(loop, w, revents); in uv__io_poll()
429 if (loop->flags & UV_LOOP_REAP_CHILDREN) { in uv__io_poll()
430 loop->flags &= ~UV_LOOP_REAP_CHILDREN; in uv__io_poll()
431 uv__wait_children(loop); in uv__io_poll()
434 uv__metrics_inc_events(loop, nevents); in uv__io_poll()
438 uv__metrics_inc_events_waiting(loop, nevents); in uv__io_poll()
442 uv__metrics_update_idle_time(loop); in uv__io_poll()
443 loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); in uv__io_poll()
446 loop->watchers[loop->nwatchers] = NULL; in uv__io_poll()
447 loop->watchers[loop->nwatchers + 1] = NULL; in uv__io_poll()
470 diff = loop->time - base; in uv__io_poll()
479 void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { in uv__platform_invalidate_fd() argument
484 assert(loop->watchers != NULL); in uv__platform_invalidate_fd()
487 events = (struct kevent*) loop->watchers[loop->nwatchers]; in uv__platform_invalidate_fd()
488 nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; in uv__platform_invalidate_fd()
499 static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags) { in uv__fs_event() argument
556 if (kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL)) in uv__fs_event()
561 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { in uv_fs_event_init() argument
562 uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); in uv_fs_event_init()
625 uv__io_start(handle->loop, &handle->event_watcher, POLLIN); in uv_fs_event_start()
648 uv__io_close(handle->loop, &handle->event_watcher); in uv_fs_event_stop()