diff options
author | Brad King <brad.king@kitware.com> | 2022-09-22 18:10:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-09-27 13:50:16 (GMT) |
commit | ff82df301c6db009200cbe3869fa03b86a573253 (patch) | |
tree | df3700f506d1f03ce8176bc3fd3e8aa872630cce /Utilities/cmlibuv/src/unix/kqueue.c | |
parent | cfe8fd64217d42c7a5c8a12c65feddbace86ce21 (diff) | |
parent | a23da1559648995998343f3ae63076db736b55a5 (diff) | |
download | CMake-ff82df301c6db009200cbe3869fa03b86a573253.zip CMake-ff82df301c6db009200cbe3869fa03b86a573253.tar.gz CMake-ff82df301c6db009200cbe3869fa03b86a573253.tar.bz2 |
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv:
libuv 2022-07-12 (0c1fa696)
Diffstat (limited to 'Utilities/cmlibuv/src/unix/kqueue.c')
-rw-r--r-- | Utilities/cmlibuv/src/unix/kqueue.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Utilities/cmlibuv/src/unix/kqueue.c b/Utilities/cmlibuv/src/unix/kqueue.c index 75e9110..5dac76a 100644 --- a/Utilities/cmlibuv/src/unix/kqueue.c +++ b/Utilities/cmlibuv/src/unix/kqueue.c @@ -117,6 +117,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { unsigned int revents; QUEUE* q; uv__io_t* w; + uv_process_t* process; sigset_t* pset; sigset_t set; uint64_t base; @@ -285,6 +286,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { for (i = 0; i < nfds; i++) { ev = events + i; fd = ev->ident; + + /* Handle kevent NOTE_EXIT results */ + if (ev->filter == EVFILT_PROC) { + QUEUE_FOREACH(q, &loop->process_handles) { + process = QUEUE_DATA(q, uv_process_t, queue); + if (process->pid == fd) { + process->flags |= UV_HANDLE_REAP; + loop->flags |= UV_LOOP_REAP_CHILDREN; + break; + } + } + nevents++; + continue; + } + /* Skip invalidated events, see uv__platform_invalidate_fd */ if (fd == -1) continue; @@ -377,6 +393,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { nevents++; } + if (loop->flags & UV_LOOP_REAP_CHILDREN) { + loop->flags &= ~UV_LOOP_REAP_CHILDREN; + uv__wait_children(loop); + } + if (reset_timeout != 0) { timeout = user_timeout; reset_timeout = 0; @@ -435,7 +456,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { /* Invalidate events with same file descriptor */ for (i = 0; i < nfds; i++) - if ((int) events[i].ident == fd) + if ((int) events[i].ident == fd && events[i].filter != EVFILT_PROC) events[i].ident = -1; } |