diff options
author | Brad King <brad.king@kitware.com> | 2021-11-17 11:40:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-11-17 11:40:02 (GMT) |
commit | 74a05716a453d1cffbba4a1b300c7cafea17b8f5 (patch) | |
tree | a8b1b793607796938219d94a57ba4ce2924e3c8f /Utilities/cmlibuv/src/unix/poll.c | |
parent | 65fb29fdfbe1663fe0f050214c43bf24238fbbfe (diff) | |
parent | 27e34e6190ba1014c20ef5e8ffa7d653595ced12 (diff) | |
download | CMake-74a05716a453d1cffbba4a1b300c7cafea17b8f5.zip CMake-74a05716a453d1cffbba4a1b300c7cafea17b8f5.tar.gz CMake-74a05716a453d1cffbba4a1b300c7cafea17b8f5.tar.bz2 |
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv:
libuv 2021-11-09 (0f696da5)
Diffstat (limited to 'Utilities/cmlibuv/src/unix/poll.c')
-rw-r--r-- | Utilities/cmlibuv/src/unix/poll.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Utilities/cmlibuv/src/unix/poll.c b/Utilities/cmlibuv/src/unix/poll.c index 3d5022b..7a12e2d 100644 --- a/Utilities/cmlibuv/src/unix/poll.c +++ b/Utilities/cmlibuv/src/unix/poll.c @@ -79,9 +79,10 @@ int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { * Workaround for e.g. kqueue fds not supporting ioctls. */ err = uv__nonblock(fd, 1); +#if UV__NONBLOCK_IS_IOCTL if (err == UV_ENOTTY) - if (uv__nonblock == uv__nonblock_ioctl) - err = uv__nonblock_fcntl(fd, 1); + err = uv__nonblock_fcntl(fd, 1); +#endif if (err) return err; @@ -116,12 +117,21 @@ int uv_poll_stop(uv_poll_t* handle) { int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) { + uv__io_t** watchers; + uv__io_t* w; int events; assert((pevents & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT | UV_PRIORITIZED)) == 0); assert(!uv__is_closing(handle)); + watchers = handle->loop->watchers; + w = &handle->io_watcher; + + if (uv__fd_exists(handle->loop, w->fd)) + if (watchers[w->fd] != w) + return UV_EEXIST; + uv__poll_stop(handle); if (pevents == 0) |