summaryrefslogtreecommitdiff
path: root/epoll.c
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2020-03-01 16:01:12 +0300
committerAzat Khuzhin <azat@libevent.org>2020-03-01 18:03:46 +0300
commit9a9b92ed06249be8326d82e2483b87e1a1b4caac (patch)
treeaba0a59523958b16ce68adea899240b6bc944622 /epoll.c
parent4e5a41ca0f668da1a18832e5cb02b4afeae074ff (diff)
downloadlibevent-9a9b92ed06249be8326d82e2483b87e1a1b4caac.tar.gz
Add EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD flag (fixes: #958)
By default we are using CLOCK_MONOTONIC_COARSE, but if EVENT_BASE_FLAG_PRECISE_TIMER isset, then CLOCK_MONOTONIC will be used, however this will also enable timerfd, while this is not always what someone wants, hence add a flag to control this (by default the old behavior is preserved, set new flag to change it).
Diffstat (limited to 'epoll.c')
-rw-r--r--epoll.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/epoll.c b/epoll.c
index a0df0d21..1d4393e6 100644
--- a/epoll.c
+++ b/epoll.c
@@ -189,6 +189,7 @@ epoll_init(struct event_base *base)
event_base, we can try to use timerfd to give them finer granularity.
*/
if ((base->flags & EVENT_BASE_FLAG_PRECISE_TIMER) &&
+ !(base->flags & EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD) &&
base->monotonic_timer.monotonic_clock == CLOCK_MONOTONIC) {
int fd;
fd = epollop->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC);