From b445ecde51a004e6967ef1d0386431756ed959a2 Mon Sep 17 00:00:00 2001 From: llmII Date: Fri, 3 Sep 2021 15:48:31 -0500 Subject: [PATCH] Add kqueue option to meson, janetconf, fix typoes --- meson.build | 1 + meson_options.txt | 1 + src/conf/janetconf.h | 1 + src/core/ev.c | 16 ++++++++-------- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index ebcc33ee..0f52020c 100644 --- a/meson.build +++ b/meson.build @@ -73,6 +73,7 @@ conf.set('JANET_NO_REALPATH', not get_option('realpath')) conf.set('JANET_NO_PROCESSES', not get_option('processes')) conf.set('JANET_SIMPLE_GETLINE', get_option('simple_getline')) conf.set('JANET_EV_NO_EPOLL', not get_option('epoll')) +conf.set('JANET_EV_NO_KQUEUE', not get_option('kqueue')) conf.set('JANET_NO_THREADS', get_option('threads')) conf.set('JANET_NO_INTERPRETER_INTERRUPT', not get_option('interpreter_interrupt')) if get_option('os_name') != '' diff --git a/meson_options.txt b/meson_options.txt index 9a2818e6..bfaf041f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,6 +18,7 @@ option('umask', type : 'boolean', value : true) option('realpath', type : 'boolean', value : true) option('simple_getline', type : 'boolean', value : false) option('epoll', type : 'boolean', value : false) +option('kqueue', type : 'boolen', value : false) option('interpreter_interrupt', type : 'boolean', value : false) option('recursion_guard', type : 'integer', min : 10, max : 8000, value : 1024) diff --git a/src/conf/janetconf.h b/src/conf/janetconf.h index f46ef245..bc11666d 100644 --- a/src/conf/janetconf.h +++ b/src/conf/janetconf.h @@ -48,6 +48,7 @@ /* #define JANET_OS_NAME my-custom-os */ /* #define JANET_ARCH_NAME pdp-8 */ /* #define JANET_EV_NO_EPOLL */ +/* #define JANET_EV_NO_KQUEUE */ /* #define JANET_NO_INTERPRETER_INTERRUPT */ /* Custom vm allocator support */ diff --git a/src/core/ev.c b/src/core/ev.c index 7e5f1904..7db027fc 100644 --- a/src/core/ev.c +++ b/src/core/ev.c @@ -1679,17 +1679,17 @@ void janet_loop1_impl(int has_timeout, JanetTimestamp timeout) { statuses[i] = JANET_ASYNC_STATUS_NOT_DONE; if (events[i].filter == EVFILT_WRITE) - status[0] = state->machine(state, JANET_ASYNC_EVENT_WRITE); + statuses[0] = state->machine(state, JANET_ASYNC_EVENT_WRITE); if (events[i].filter == EVFILT_READ) - status[1] = state->machine(state, JANET_ASYNC_EVENT_READ); + statuses[1] = state->machine(state, JANET_ASYNC_EVENT_READ); if (events[i].flags & EV_ERROR) - status[2] = state->machine(state, JANET_ASYNC_EVENT_ERR); + statuses[2] = state->machine(state, JANET_ASYNC_EVENT_ERR); if ((events[i].flags & EV_EOF) && !(events[i].data > 0)) - status[3] = state->maine(state, JANET_ASYNC_EVENT_HUP); - if(status[0] == JANET_ASYNC_STATUS_DONE || - status[1] == JANET_ASYNC_STATUS_DONE || - status[2] == JANET_ASYNC_STATUS_DONE || - status[3] == JANET_ASYNC_STATUSDONE) + statuses[3] = state->maine(state, JANET_ASYNC_EVENT_HUP); + if(statuses[0] == JANET_ASYNC_STATUS_DONE || + statuses[1] == JANET_ASYNC_STATUS_DONE || + statuses[2] == JANET_ASYNC_STATUS_DONE || + statuses[3] == JANET_ASYNC_STATUS_DONE) janet_unlisten(state, 0); } }