Lines Matching refs:ev

33 static void nxt_devpoll_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
34 static void nxt_devpoll_disable(nxt_event_engine_t *engine, 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);
46 nxt_fd_event_t *ev);
48 nxt_fd_event_t *ev);
50 nxt_fd_event_t *ev);
52 nxt_fd_event_t *ev);
53 static void nxt_devpoll_change(nxt_event_engine_t *engine, nxt_fd_event_t *ev,
57 nxt_fd_event_t *ev);
170 nxt_devpoll_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_enable() argument
172 ev->read = NXT_EVENT_ACTIVE; in nxt_devpoll_enable()
173 ev->write = NXT_EVENT_ACTIVE; in nxt_devpoll_enable()
175 nxt_devpoll_change(engine, ev, NXT_DEVPOLL_ADD, POLLIN | POLLOUT); in nxt_devpoll_enable()
180 nxt_devpoll_disable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_disable() argument
182 if (ev->read != NXT_EVENT_INACTIVE || ev->write != NXT_EVENT_INACTIVE) { in nxt_devpoll_disable()
184 ev->read = NXT_EVENT_INACTIVE; in nxt_devpoll_disable()
185 ev->write = NXT_EVENT_INACTIVE; in nxt_devpoll_disable()
187 nxt_devpoll_change(engine, ev, NXT_DEVPOLL_DELETE, POLLREMOVE); in nxt_devpoll_disable()
218 nxt_devpoll_close(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_close() argument
220 nxt_devpoll_disable(engine, ev); in nxt_devpoll_close()
222 return ev->changing; in nxt_devpoll_close()
238 nxt_devpoll_enable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_enable_read() argument
242 if (ev->read != NXT_EVENT_BLOCKED) { in nxt_devpoll_enable_read()
246 if (ev->write == NXT_EVENT_INACTIVE) { in nxt_devpoll_enable_read()
249 } else if (ev->write == NXT_EVENT_BLOCKED) { in nxt_devpoll_enable_read()
250 ev->write = NXT_EVENT_INACTIVE; in nxt_devpoll_enable_read()
258 nxt_devpoll_change(engine, ev, op, events); in nxt_devpoll_enable_read()
261 ev->read = NXT_EVENT_ACTIVE; in nxt_devpoll_enable_read()
266 nxt_devpoll_enable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_enable_write() argument
270 if (ev->write != NXT_EVENT_BLOCKED) { in nxt_devpoll_enable_write()
274 if (ev->read == NXT_EVENT_INACTIVE) { in nxt_devpoll_enable_write()
277 } else if (ev->read == NXT_EVENT_BLOCKED) { in nxt_devpoll_enable_write()
278 ev->read = NXT_EVENT_INACTIVE; in nxt_devpoll_enable_write()
286 nxt_devpoll_change(engine, ev, op, events); in nxt_devpoll_enable_write()
289 ev->write = NXT_EVENT_ACTIVE; in nxt_devpoll_enable_write()
294 nxt_devpoll_disable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_disable_read() argument
298 ev->read = NXT_EVENT_INACTIVE; in nxt_devpoll_disable_read()
300 if (ev->write <= NXT_EVENT_BLOCKED) { in nxt_devpoll_disable_read()
301 ev->write = NXT_EVENT_INACTIVE; in nxt_devpoll_disable_read()
310 nxt_devpoll_change(engine, ev, op, events); in nxt_devpoll_disable_read()
315 nxt_devpoll_disable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_disable_write() argument
319 ev->write = NXT_EVENT_INACTIVE; in nxt_devpoll_disable_write()
321 if (ev->read <= NXT_EVENT_BLOCKED) { in nxt_devpoll_disable_write()
322 ev->read = NXT_EVENT_INACTIVE; in nxt_devpoll_disable_write()
331 nxt_devpoll_change(engine, ev, op, events); in nxt_devpoll_disable_write()
336 nxt_devpoll_block_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_block_read() argument
338 if (ev->read != NXT_EVENT_INACTIVE) { in nxt_devpoll_block_read()
339 ev->read = NXT_EVENT_BLOCKED; in nxt_devpoll_block_read()
345 nxt_devpoll_block_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_block_write() argument
347 if (ev->write != NXT_EVENT_INACTIVE) { in nxt_devpoll_block_write()
348 ev->write = NXT_EVENT_BLOCKED; in nxt_devpoll_block_write()
354 nxt_devpoll_oneshot_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_oneshot_read() argument
356 nxt_devpoll_enable_read(engine, ev); in nxt_devpoll_oneshot_read()
358 ev->read = NXT_EVENT_ONESHOT; in nxt_devpoll_oneshot_read()
363 nxt_devpoll_oneshot_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_oneshot_write() argument
365 nxt_devpoll_enable_write(engine, ev); in nxt_devpoll_oneshot_write()
367 ev->write = NXT_EVENT_ONESHOT; in nxt_devpoll_oneshot_write()
372 nxt_devpoll_change(nxt_event_engine_t *engine, nxt_fd_event_t *ev, in nxt_devpoll_change() argument
377 nxt_debug(ev->task, "devpoll %d change fd:%d op:%ui ev:%04Xi", in nxt_devpoll_change()
378 engine->u.devpoll.fd, ev->fd, op, events); in nxt_devpoll_change()
384 ev->changing = 1; in nxt_devpoll_change()
389 change->event = ev; in nxt_devpoll_change()
399 nxt_fd_event_t *ev; in nxt_devpoll_commit_changes() local
412 ev = change->event; in nxt_devpoll_commit_changes()
415 ev->fd, change->op, change->events); in nxt_devpoll_commit_changes()
419 pfd->fd = ev->fd; in nxt_devpoll_commit_changes()
425 pfd->fd = ev->fd; in nxt_devpoll_commit_changes()
429 ev->changing = 0; in nxt_devpoll_commit_changes()
453 ev = change->event; in nxt_devpoll_commit_changes()
456 ret = nxt_fd_event_hash_add(&engine->u.devpoll.fd_hash, ev->fd, ev); in nxt_devpoll_commit_changes()
459 nxt_devpoll_change_error(engine, ev); in nxt_devpoll_commit_changes()
465 ev->fd, 0); in nxt_devpoll_commit_changes()
481 nxt_devpoll_change_error(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_devpoll_change_error() argument
483 ev->read = NXT_EVENT_INACTIVE; in nxt_devpoll_change_error()
484 ev->write = NXT_EVENT_INACTIVE; in nxt_devpoll_change_error()
486 nxt_work_queue_add(&engine->fast_work_queue, ev->error_handler, in nxt_devpoll_change_error()
487 ev->task, ev, ev->data); in nxt_devpoll_change_error()
489 nxt_fd_event_hash_delete(ev->task, &engine->u.devpoll.fd_hash, ev->fd, 1); in nxt_devpoll_change_error()
491 nxt_devpoll_remove(engine, ev->fd); in nxt_devpoll_change_error()
565 nxt_fd_event_t *ev; in nxt_devpoll_poll() local
605 ev = nxt_fd_event_hash_get(&engine->task, &engine->u.devpoll.fd_hash, in nxt_devpoll_poll()
608 if (nxt_slow_path(ev == NULL)) { in nxt_devpoll_poll()
618 nxt_debug(ev->task, "devpoll: fd:%d ev:%04uXi rd:%d wr:%d", in nxt_devpoll_poll()
619 fd, events, ev->read, ev->write); in nxt_devpoll_poll()
622 nxt_alert(ev->task, in nxt_devpoll_poll()
626 nxt_work_queue_add(&engine->fast_work_queue, ev->error_handler, in nxt_devpoll_poll()
627 ev->task, ev, ev->data); in nxt_devpoll_poll()
632 ev->read_ready = 1; in nxt_devpoll_poll()
634 if (ev->read != NXT_EVENT_BLOCKED) { in nxt_devpoll_poll()
635 nxt_work_queue_add(ev->read_work_queue, ev->read_handler, in nxt_devpoll_poll()
636 ev->task, ev, ev->data); in nxt_devpoll_poll()
639 if (ev->read == NXT_EVENT_BLOCKED in nxt_devpoll_poll()
640 || ev->read == NXT_EVENT_ONESHOT) in nxt_devpoll_poll()
642 nxt_devpoll_disable_read(engine, ev); in nxt_devpoll_poll()
647 ev->write_ready = 1; in nxt_devpoll_poll()
649 if (ev->write != NXT_EVENT_BLOCKED) { in nxt_devpoll_poll()
650 nxt_work_queue_add(ev->write_work_queue, ev->write_handler, in nxt_devpoll_poll()
651 ev->task, ev, ev->data); in nxt_devpoll_poll()
654 if (ev->write == NXT_EVENT_BLOCKED in nxt_devpoll_poll()
655 || ev->write == NXT_EVENT_ONESHOT) in nxt_devpoll_poll()
657 nxt_devpoll_disable_write(engine, ev); in nxt_devpoll_poll()