Lines Matching refs:loop

30 int uv_loop_init(uv_loop_t* loop) {  in uv_loop_init()  argument
36 saved_data = loop->data; in uv_loop_init()
37 memset(loop, 0, sizeof(*loop)); in uv_loop_init()
38 loop->data = saved_data; in uv_loop_init()
43 loop->internal_fields = lfields; in uv_loop_init()
52 heap_init((struct heap*) &loop->timer_heap); in uv_loop_init()
53 uv__queue_init(&loop->wq); in uv_loop_init()
54 uv__queue_init(&loop->idle_handles); in uv_loop_init()
55 uv__queue_init(&loop->async_handles); in uv_loop_init()
56 uv__queue_init(&loop->check_handles); in uv_loop_init()
57 uv__queue_init(&loop->prepare_handles); in uv_loop_init()
58 uv__queue_init(&loop->handle_queue); in uv_loop_init()
60 loop->active_handles = 0; in uv_loop_init()
61 loop->active_reqs.count = 0; in uv_loop_init()
62 loop->nfds = 0; in uv_loop_init()
63 loop->watchers = NULL; in uv_loop_init()
64 loop->nwatchers = 0; in uv_loop_init()
65 uv__queue_init(&loop->pending_queue); in uv_loop_init()
66 uv__queue_init(&loop->watcher_queue); in uv_loop_init()
68 loop->closing_handles = NULL; in uv_loop_init()
69 uv__update_time(loop); in uv_loop_init()
70 loop->async_io_watcher.fd = -1; in uv_loop_init()
71 loop->async_wfd = -1; in uv_loop_init()
72 loop->signal_pipefd[0] = -1; in uv_loop_init()
73 loop->signal_pipefd[1] = -1; in uv_loop_init()
74 loop->backend_fd = -1; in uv_loop_init()
75 loop->emfile_fd = -1; in uv_loop_init()
77 loop->timer_counter = 0; in uv_loop_init()
78 loop->stop_flag = 0; in uv_loop_init()
80 err = uv__platform_loop_init(loop); in uv_loop_init()
85 err = uv__process_init(loop); in uv_loop_init()
88 uv__queue_init(&loop->process_handles); in uv_loop_init()
90 err = uv_rwlock_init(&loop->cloexec_lock); in uv_loop_init()
94 err = uv_mutex_init(&loop->wq_mutex); in uv_loop_init()
98 err = uv_async_init(loop, &loop->wq_async, uv__work_done); in uv_loop_init()
102 uv__handle_unref(&loop->wq_async); in uv_loop_init()
103 loop->wq_async.flags |= UV_HANDLE_INTERNAL; in uv_loop_init()
108 uv_mutex_destroy(&loop->wq_mutex); in uv_loop_init()
111 uv_rwlock_destroy(&loop->cloexec_lock); in uv_loop_init()
114 uv__signal_loop_cleanup(loop); in uv_loop_init()
117 uv__platform_loop_delete(loop); in uv_loop_init()
124 loop->internal_fields = NULL; in uv_loop_init()
126 uv__free(loop->watchers); in uv_loop_init()
127 loop->nwatchers = 0; in uv_loop_init()
132 int uv_loop_fork(uv_loop_t* loop) { in uv_loop_fork() argument
137 err = uv__io_fork(loop); in uv_loop_fork()
141 err = uv__async_fork(loop); in uv_loop_fork()
145 err = uv__signal_loop_fork(loop); in uv_loop_fork()
150 for (i = 0; i < loop->nwatchers; i++) { in uv_loop_fork()
151 w = loop->watchers[i]; in uv_loop_fork()
157 uv__queue_insert_tail(&loop->watcher_queue, &w->watcher_queue); in uv_loop_fork()
165 void uv__loop_close(uv_loop_t* loop) { in uv__loop_close() argument
168 uv__signal_loop_cleanup(loop); in uv__loop_close()
169 uv__platform_loop_delete(loop); in uv__loop_close()
170 uv__async_stop(loop); in uv__loop_close()
172 if (loop->emfile_fd != -1) { in uv__loop_close()
173 uv__close(loop->emfile_fd); in uv__loop_close()
174 loop->emfile_fd = -1; in uv__loop_close()
177 if (loop->backend_fd != -1) { in uv__loop_close()
178 uv__close(loop->backend_fd); in uv__loop_close()
179 loop->backend_fd = -1; in uv__loop_close()
182 uv_mutex_lock(&loop->wq_mutex); in uv__loop_close()
183 assert(uv__queue_empty(&loop->wq) && "thread pool work queue not empty!"); in uv__loop_close()
184 assert(!uv__has_active_reqs(loop)); in uv__loop_close()
185 uv_mutex_unlock(&loop->wq_mutex); in uv__loop_close()
186 uv_mutex_destroy(&loop->wq_mutex); in uv__loop_close()
192 uv_rwlock_destroy(&loop->cloexec_lock); in uv__loop_close()
195 assert(uv__queue_empty(&loop->pending_queue)); in uv__loop_close()
196 assert(uv__queue_empty(&loop->watcher_queue)); in uv__loop_close()
197 assert(loop->nfds == 0); in uv__loop_close()
200 uv__free(loop->watchers); in uv__loop_close()
201 loop->watchers = NULL; in uv__loop_close()
202 loop->nwatchers = 0; in uv__loop_close()
204 lfields = uv__get_internal_fields(loop); in uv__loop_close()
207 loop->internal_fields = NULL; in uv__loop_close()
211 int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { in uv__loop_configure() argument
214 lfields = uv__get_internal_fields(loop); in uv__loop_configure()
222 loop->flags |= UV_LOOP_ENABLE_IO_URING_SQPOLL; in uv__loop_configure()
234 loop->flags |= UV_LOOP_BLOCK_SIGPROF; in uv__loop_configure()