From 54d73f67220e9940702b7d99956b6ee7144a10e7 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Wed, 21 Jul 2021 21:46:26 -0500 Subject: [PATCH] Make epoll the default on Linux for event loop implementations. --- meson.build | 2 +- src/conf/janetconf.h | 2 +- src/include/janet.h | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 55511b35..30888bd8 100644 --- a/meson.build +++ b/meson.build @@ -72,7 +72,7 @@ conf.set('JANET_NO_UMASK', not get_option('umask')) 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_EPOLL', get_option('epoll')) +conf.set('JANET_EV_NO_EPOLL', not get_option('epoll')) conf.set('JANET_NO_THREADS', get_option('threads')) if get_option('os_name') != '' conf.set('JANET_OS_NAME', get_option('os_name')) diff --git a/src/conf/janetconf.h b/src/conf/janetconf.h index cd143c83..dfabc1cb 100644 --- a/src/conf/janetconf.h +++ b/src/conf/janetconf.h @@ -47,7 +47,7 @@ /* #define JANET_STACK_MAX 16384 */ /* #define JANET_OS_NAME my-custom-os */ /* #define JANET_ARCH_NAME pdp-8 */ -/* #define JANET_EV_EPOLL */ +/* #define JANET_EV_NO_EPOLL */ /* Custom vm allocator support */ /* #include */ diff --git a/src/include/janet.h b/src/include/janet.h index c14aacdb..7e68236e 100644 --- a/src/include/janet.h +++ b/src/include/janet.h @@ -193,6 +193,11 @@ extern "C" { #define JANET_INT_TYPES #endif +/* Enable or disable epoll on Linux */ +#if defined(JANET_LINUX) && !defined(JANET_EV_NO_EPOLL) +#define JANET_EV_EPOLL +#endif + /* How to export symbols */ #ifndef JANET_API #ifdef JANET_WINDOWS