From 555e0c0b85776b968b2af27c0d090cd0098579d0 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sun, 8 Oct 2023 10:52:27 -0500 Subject: [PATCH] Try to capture more events in kqueue. --- src/core/ev.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/core/ev.c b/src/core/ev.c index fd23e73f..d7108a51 100644 --- a/src/core/ev.c +++ b/src/core/ev.c @@ -1628,7 +1628,6 @@ void janet_ev_deinit(void) { * https://github.com/wahern/cqueues/blob/master/src/lib/kpoll.c * NetBSD uses intptr_t while others use void * for .udata */ #define EV_SETx(ev, a, b, c, d, e, f) EV_SET((ev), (a), (b), (c), (d), (e), ((__typeof__((ev)->udata))(f))) -#define JANET_KQUEUE_TF (EV_ADD | EV_ENABLE | EV_CLEAR | EV_ONESHOT) #define JANET_KQUEUE_MIN_INTERVAL 0 /* NOTE: @@ -1716,16 +1715,15 @@ void janet_loop1_impl(int has_timeout, JanetTimestamp timeout) { if (!f) continue; if (f->ev_callback && has_err) { f->ev_callback(f, JANET_ASYNC_EVENT_ERR); - } else { - if (f->ev_callback && (filt == EVFILT_READ) && f == stream->read_fiber) { - f->ev_callback(f, JANET_ASYNC_EVENT_READ); - } - if (f->ev_callback && (filt == EVFILT_WRITE) && f == stream->write_fiber) { - f->ev_callback(f, JANET_ASYNC_EVENT_WRITE); - } - if (f->ev_callback && has_hup) { - f->ev_callback(f, JANET_ASYNC_EVENT_HUP); - } + } + if (f->ev_callback && (filt == EVFILT_READ) && f == stream->read_fiber) { + f->ev_callback(f, JANET_ASYNC_EVENT_READ); + } + if (f->ev_callback && (filt == EVFILT_WRITE) && f == stream->write_fiber) { + f->ev_callback(f, JANET_ASYNC_EVENT_WRITE); + } + if (f->ev_callback && has_hup) { + f->ev_callback(f, JANET_ASYNC_EVENT_HUP); } } janet_stream_checktoclose(stream);