From defe60e08b6400381e0ce28ed0d858a5469becb5 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sun, 8 Oct 2023 13:14:36 -0500 Subject: [PATCH] Handle refcounts in posted events. --- src/core/ev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ev.c b/src/core/ev.c index 256f7fab..4ddabd0c 100644 --- a/src/core/ev.c +++ b/src/core/ev.c @@ -1660,8 +1660,8 @@ static void timestamp2timespec(struct timespec *t, JanetTimestamp ts) { void janet_register_stream(JanetStream *stream) { struct kevent kevs[2]; - EV_SETx(&kevs[0], stream->handle, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR | EV_EOF, 0, 0, stream); - EV_SETx(&kevs[1], stream->handle, EVFILT_WRITE, EV_ADD | EV_ENABLE | EV_CLEAR | EV_EOF, 0, 0, stream); + EV_SETx(&kevs[0], stream->handle, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR, 0, 0, stream); + EV_SETx(&kevs[1], stream->handle, EVFILT_WRITE, EV_ADD | EV_ENABLE | EV_CLEAR, 0, 0, stream); int status; do { status = kevent(janet_vm.kq, kevs, 2, NULL, 0, NULL); @@ -1740,7 +1740,7 @@ void janet_ev_init(void) { janet_vm.timer_enabled = 0; if (janet_vm.kq == -1) goto error; struct kevent event; - EV_SETx(&event, janet_vm.selfpipe[0], EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, janet_vm.selfpipe); + EV_SETx(&event, janet_vm.selfpipe[0], EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR, 0, 0, janet_vm.selfpipe); int status; do { status = kevent(janet_vm.kq, &event, 1, NULL, 0, NULL);