Lines Matching refs:loop
67 int uv__platform_loop_init(uv_loop_t* loop) { in uv__platform_loop_init() argument
71 loop->fs_fd = -1; in uv__platform_loop_init()
72 loop->backend_fd = -1; in uv__platform_loop_init()
83 loop->backend_fd = fd; in uv__platform_loop_init()
89 void uv__platform_loop_delete(uv_loop_t* loop) { in uv__platform_loop_delete() argument
90 if (loop->fs_fd != -1) { in uv__platform_loop_delete()
91 uv__close(loop->fs_fd); in uv__platform_loop_delete()
92 loop->fs_fd = -1; in uv__platform_loop_delete()
95 if (loop->backend_fd != -1) { in uv__platform_loop_delete()
96 uv__close(loop->backend_fd); in uv__platform_loop_delete()
97 loop->backend_fd = -1; in uv__platform_loop_delete()
102 int uv__io_fork(uv_loop_t* loop) { in uv__io_fork() argument
104 if (loop->fs_fd != -1) { in uv__io_fork()
106 uv__io_stop(loop, &loop->fs_event_watcher, POLLIN); in uv__io_fork()
109 uv__platform_loop_delete(loop); in uv__io_fork()
110 return uv__platform_loop_init(loop); in uv__io_fork()
114 void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { in uv__platform_invalidate_fd() argument
119 assert(loop->watchers != NULL); in uv__platform_invalidate_fd()
122 events = (struct port_event*) loop->watchers[loop->nwatchers]; in uv__platform_invalidate_fd()
123 nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; in uv__platform_invalidate_fd()
134 int uv__io_check_fd(uv_loop_t* loop, int fd) { in uv__io_check_fd() argument
135 if (port_associate(loop->backend_fd, PORT_SOURCE_FD, fd, POLLIN, 0)) in uv__io_check_fd()
138 if (port_dissociate(loop->backend_fd, PORT_SOURCE_FD, fd)) { in uv__io_check_fd()
147 void uv__io_poll(uv_loop_t* loop, int timeout) { in uv__io_poll() argument
168 if (loop->nfds == 0) { in uv__io_poll()
169 assert(uv__queue_empty(&loop->watcher_queue)); in uv__io_poll()
173 while (!uv__queue_empty(&loop->watcher_queue)) { in uv__io_poll()
174 q = uv__queue_head(&loop->watcher_queue); in uv__io_poll()
181 if (port_associate(loop->backend_fd, in uv__io_poll()
194 if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { in uv__io_poll()
201 base = loop->time; in uv__io_poll()
204 if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) { in uv__io_poll()
217 uv__metrics_set_provider_entry_time(loop); in uv__io_poll()
233 err = port_getn(loop->backend_fd, in uv__io_poll()
258 SAVE_ERRNO(uv__update_time(loop)); in uv__io_poll()
283 assert(loop->watchers != NULL); in uv__io_poll()
284 loop->watchers[loop->nwatchers] = (void*) events; in uv__io_poll()
285 loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; in uv__io_poll()
295 assert((unsigned) fd < loop->nwatchers); in uv__io_poll()
297 w = loop->watchers[fd]; in uv__io_poll()
306 if (w == &loop->signal_io_watcher) { in uv__io_poll()
309 uv__metrics_update_idle_time(loop); in uv__io_poll()
310 w->cb(loop, w, pe->portev_events); in uv__io_poll()
315 if (w != loop->watchers[fd]) in uv__io_poll()
320 uv__queue_insert_tail(&loop->watcher_queue, &w->watcher_queue); in uv__io_poll()
323 uv__metrics_inc_events(loop, nevents); in uv__io_poll()
327 uv__metrics_inc_events_waiting(loop, nevents); in uv__io_poll()
331 uv__metrics_update_idle_time(loop); in uv__io_poll()
332 loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); in uv__io_poll()
335 loop->watchers[loop->nwatchers] = NULL; in uv__io_poll()
336 loop->watchers[loop->nwatchers + 1] = NULL; in uv__io_poll()
364 diff = loop->time - base; in uv__io_poll()
436 if (port_associate(handle->loop->fs_fd, in uv__fs_event_rearm()
449 static void uv__fs_event_read(uv_loop_t* loop, in uv__fs_event_read() argument
474 r = port_getn(loop->fs_fd, &pe, 1, &n, &timeout); in uv__fs_event_read()
509 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { in uv_fs_event_init() argument
510 uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); in uv_fs_event_init()
527 if (handle->loop->fs_fd == -1) { in uv_fs_event_start()
531 handle->loop->fs_fd = portfd; in uv_fs_event_start()
549 uv__io_init(&handle->loop->fs_event_watcher, uv__fs_event_read, portfd); in uv_fs_event_start()
550 uv__io_start(handle->loop, &handle->loop->fs_event_watcher, POLLIN); in uv_fs_event_start()
564 ret = port_dissociate(handle->loop->fs_fd, in uv__fs_event_stop()
599 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { in uv_fs_event_init() argument