aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/common/erl_poll.h
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-11-03 11:32:01 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-04-13 15:59:22 +0200
commite6d3da55a2fe06730f3b92098ff8c13e16e3254b (patch)
tree68f8ced6767f0b0f69514ea57c1d4805455f836f /erts/emulator/sys/common/erl_poll.h
parent6e3e48d39a77aa18b92fb048d6a910baa71badf3 (diff)
downloadotp-e6d3da55a2fe06730f3b92098ff8c13e16e3254b.tar.gz
otp-e6d3da55a2fe06730f3b92098ff8c13e16e3254b.tar.bz2
otp-e6d3da55a2fe06730f3b92098ff8c13e16e3254b.zip
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.
Diffstat (limited to 'erts/emulator/sys/common/erl_poll.h')
-rw-r--r--erts/emulator/sys/common/erl_poll.h8
1 files changed, 8 insertions, 0 deletions
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 <sys/epoll.h>
+#ifdef HAVE_SYS_TIMERFD_H
+#include <sys/timerfd.h>
+#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) \