Lines Matching refs:ev

32 static void nxt_poll_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
34 nxt_fd_event_t *ev);
36 nxt_fd_event_t *ev);
38 nxt_fd_event_t *ev);
40 nxt_fd_event_t *ev);
42 nxt_fd_event_t *ev);
44 nxt_fd_event_t *ev);
45 static void nxt_poll_block_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
47 nxt_fd_event_t *ev);
49 nxt_fd_event_t *ev);
51 nxt_fd_event_t *ev);
52 static void nxt_poll_change(nxt_event_engine_t *engine, nxt_fd_event_t *ev,
56 nxt_fd_event_t *ev, int events);
137 nxt_poll_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_enable() argument
139 ev->read = NXT_EVENT_ACTIVE; in nxt_poll_enable()
140 ev->write = NXT_EVENT_ACTIVE; in nxt_poll_enable()
142 nxt_poll_change(engine, ev, NXT_POLL_ADD, POLLIN | POLLOUT); in nxt_poll_enable()
147 nxt_poll_disable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_disable() argument
149 if (ev->read != NXT_EVENT_INACTIVE && ev->write != NXT_EVENT_INACTIVE) { in nxt_poll_disable()
150 ev->read = NXT_EVENT_INACTIVE; in nxt_poll_disable()
151 ev->write = NXT_EVENT_INACTIVE; in nxt_poll_disable()
153 nxt_poll_change(engine, ev, NXT_POLL_DELETE, 0); in nxt_poll_disable()
159 nxt_poll_close(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_close() argument
161 nxt_poll_disable(engine, ev); in nxt_poll_close()
163 return ev->changing; in nxt_poll_close()
168 nxt_poll_enable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_enable_read() argument
172 ev->read = NXT_EVENT_ACTIVE; in nxt_poll_enable_read()
174 if (ev->write == NXT_EVENT_INACTIVE) { in nxt_poll_enable_read()
183 nxt_poll_change(engine, ev, op, events); in nxt_poll_enable_read()
188 nxt_poll_enable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_enable_write() argument
192 ev->write = NXT_EVENT_ACTIVE; in nxt_poll_enable_write()
194 if (ev->read == NXT_EVENT_INACTIVE) { in nxt_poll_enable_write()
203 nxt_poll_change(engine, ev, op, events); in nxt_poll_enable_write()
208 nxt_poll_disable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_disable_read() argument
212 ev->read = NXT_EVENT_INACTIVE; in nxt_poll_disable_read()
214 if (ev->write == NXT_EVENT_INACTIVE) { in nxt_poll_disable_read()
223 nxt_poll_change(engine, ev, op, events); in nxt_poll_disable_read()
228 nxt_poll_disable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_disable_write() argument
232 ev->write = NXT_EVENT_INACTIVE; in nxt_poll_disable_write()
234 if (ev->read == NXT_EVENT_INACTIVE) { in nxt_poll_disable_write()
243 nxt_poll_change(engine, ev, op, events); in nxt_poll_disable_write()
248 nxt_poll_block_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_block_read() argument
250 if (ev->read != NXT_EVENT_INACTIVE) { in nxt_poll_block_read()
251 nxt_poll_disable_read(engine, ev); in nxt_poll_block_read()
257 nxt_poll_block_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_block_write() argument
259 if (ev->write != NXT_EVENT_INACTIVE) { in nxt_poll_block_write()
260 nxt_poll_disable_write(engine, ev); in nxt_poll_block_write()
266 nxt_poll_oneshot_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_oneshot_read() argument
270 op = (ev->read == NXT_EVENT_INACTIVE && ev->write == NXT_EVENT_INACTIVE) ? in nxt_poll_oneshot_read()
273 ev->read = NXT_EVENT_ONESHOT; in nxt_poll_oneshot_read()
274 ev->write = NXT_EVENT_INACTIVE; in nxt_poll_oneshot_read()
276 nxt_poll_change(engine, ev, op, POLLIN); in nxt_poll_oneshot_read()
281 nxt_poll_oneshot_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_poll_oneshot_write() argument
285 op = (ev->read == NXT_EVENT_INACTIVE && ev->write == NXT_EVENT_INACTIVE) ? in nxt_poll_oneshot_write()
288 ev->read = NXT_EVENT_INACTIVE; in nxt_poll_oneshot_write()
289 ev->write = NXT_EVENT_ONESHOT; in nxt_poll_oneshot_write()
291 nxt_poll_change(engine, ev, op, POLLOUT); in nxt_poll_oneshot_write()
301 nxt_poll_change(nxt_event_engine_t *engine, nxt_fd_event_t *ev, nxt_uint_t op, in nxt_poll_change() argument
306 nxt_debug(ev->task, "poll change: fd:%d op:%d ev:%XD", ev->fd, op, events); in nxt_poll_change()
312 ev->changing = 1; in nxt_poll_change()
317 change->event = ev; in nxt_poll_change()
325 nxt_fd_event_t *ev; in nxt_poll_commit_changes() local
335 ev = change->event; in nxt_poll_commit_changes()
336 ev->changing = 0; in nxt_poll_commit_changes()
341 ret = nxt_poll_set_add(engine, ev, change->events); in nxt_poll_commit_changes()
350 ret = nxt_poll_set_change(engine, ev->fd, change->events); in nxt_poll_commit_changes()
359 ret = nxt_poll_set_delete(engine, ev->fd); in nxt_poll_commit_changes()
368 nxt_work_queue_add(&engine->fast_work_queue, ev->error_handler, in nxt_poll_commit_changes()
369 ev->task, ev, ev->data); in nxt_poll_commit_changes()
386 nxt_poll_set_add(nxt_event_engine_t *engine, nxt_fd_event_t *ev, int events) in nxt_poll_set_add() argument
394 nxt_debug(&engine->task, "poll add event: fd:%d ev:%04Xi", ev->fd, events); in nxt_poll_set_add()
413 phe->fd = ev->fd; in nxt_poll_set_add()
415 phe->event = ev; in nxt_poll_set_add()
418 pfd->fd = ev->fd; in nxt_poll_set_add()
422 lhq.key_hash = nxt_murmur_hash2(&ev->fd, sizeof(nxt_fd_t)); in nxt_poll_set_add()
508 nxt_fd_event_t *ev; in nxt_poll() local
558 ev = phe->event; in nxt_poll()
560 nxt_debug(ev->task, "poll: fd:%d ev:%04uXi rd:%d wr:%d", in nxt_poll()
561 fd, events, ev->read, ev->write); in nxt_poll()
564 nxt_alert(ev->task, "poll() error fd:%d ev:%04Xd rev:%04uXi", in nxt_poll()
571 ev->error_handler, ev->task, ev, ev->data); in nxt_poll()
604 if ((events & POLLIN) || (error && ev->read_handler != NULL)) { in nxt_poll()
606 ev->read_ready = 1; in nxt_poll()
608 if (ev->read == NXT_EVENT_ONESHOT) { in nxt_poll()
609 ev->read = NXT_EVENT_INACTIVE; in nxt_poll()
610 nxt_poll_change(engine, ev, NXT_POLL_DELETE, 0); in nxt_poll()
613 nxt_work_queue_add(ev->read_work_queue, ev->read_handler, in nxt_poll()
614 ev->task, ev, ev->data); in nxt_poll()
617 if ((events & POLLOUT) || (error && ev->write_handler != NULL)) { in nxt_poll()
618 ev->write_ready = 1; in nxt_poll()
620 if (ev->write == NXT_EVENT_ONESHOT) { in nxt_poll()
621 ev->write = NXT_EVENT_INACTIVE; in nxt_poll()
622 nxt_poll_change(engine, ev, NXT_POLL_DELETE, 0); in nxt_poll()
625 nxt_work_queue_add(ev->write_work_queue, ev->write_handler, in nxt_poll()
626 ev->task, ev, ev->data); in nxt_poll()