int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) { int events; assert((pevents & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT)) == 0); assert(!uv__is_closing(handle)); uv__poll_stop(handle); if (pevents == 0) return 0; events = 0; if (pevents & UV_READABLE) events |= POLLIN; if (pevents & UV_WRITABLE) events |= POLLOUT; if (pevents & UV_DISCONNECT) events |= UV__POLLRDHUP; uv__io_start(handle->loop, &handle->io_watcher, events); uv__handle_start(handle); handle->poll_cb = poll_cb; return 0; }
int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb poll_cb) { int ev_events; assert((events & ~(UV_READABLE | UV_WRITABLE)) == 0); assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); if (events == 0) { uv__poll_stop(handle); return 0; } ev_events = 0; if (events & UV_READABLE) ev_events |= EV_READ; if (events & UV_WRITABLE) ev_events |= EV_WRITE; ev_io_set(&handle->io_watcher, handle->fd, ev_events); ev_io_start(handle->loop->ev, &handle->io_watcher); handle->poll_cb = poll_cb; uv__handle_start(handle); return 0; }
int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) { int events; assert((pevents & ~(UV_READABLE | UV_WRITABLE)) == 0); assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); uv__poll_stop(handle); if (pevents == 0) return 0; events = 0; if (pevents & UV_READABLE) events |= UV__POLLIN; if (pevents & UV_WRITABLE) events |= UV__POLLOUT; uv__io_start(handle->loop, &handle->io_watcher, events); uv__handle_start(handle); handle->poll_cb = poll_cb; return 0; }
int uv_poll_stop(uv_poll_t* handle) { assert(!uv__is_closing(handle)); uv__poll_stop(handle); return 0; }
void uv__poll_close(uv_poll_t* handle) { uv__poll_stop(handle); }
int uv_poll_stop(uv_poll_t* handle) { assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); uv__poll_stop(handle); return 0; }