diff options
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; } |