From e6d3da55a2fe06730f3b92098ff8c13e16e3254b Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Mon, 3 Nov 2014 11:32:01 +0100 Subject: erts: Add high accuracy poll timeouts Different poll/select implementations have different ways to handle timeouts of < ms accuracy. Most have extended API like pselect or such, while others rely on using timerfds (epoll_wait). If no high accuracy timeout is available, we simply round up to nearest ms. If we do not roundup we will spin the last ms when waiting for a timeout which is not desirable. --- erts/emulator/sys/common/erl_poll.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'erts/emulator/sys/common/erl_poll.h') diff --git a/erts/emulator/sys/common/erl_poll.h b/erts/emulator/sys/common/erl_poll.h index d02ed2396b..ae2d063805 100644 --- a/erts/emulator/sys/common/erl_poll.h +++ b/erts/emulator/sys/common/erl_poll.h @@ -98,6 +98,8 @@ # endif #endif +#define ERTS_POLL_USE_TIMERFD 0 + typedef Uint32 ErtsPollEvents; #undef ERTS_POLL_EV_E2N @@ -130,6 +132,12 @@ struct erts_sys_fd_type { #include +#ifdef HAVE_SYS_TIMERFD_H +#include +#undef ERTS_POLL_USE_TIMERFD +#define ERTS_POLL_USE_TIMERFD 1 +#endif + #define ERTS_POLL_EV_E2N(EV) \ ((__uint32_t) (EV)) #define ERTS_POLL_EV_N2E(EV) \ -- cgit v1.2.3