diff --git a/epoll.c b/epoll.c index a0df0d21bf..1d4393e6ca 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); diff --git a/include/event2/event.h b/include/event2/event.h index 2dd5088a2b..85df418a8d 100644 --- a/include/event2/event.h +++ b/include/event2/event.h @@ -570,7 +570,20 @@ enum event_base_config_flag { however, we use less efficient more precise timer, assuming one is present. */ - EVENT_BASE_FLAG_PRECISE_TIMER = 0x20 + EVENT_BASE_FLAG_PRECISE_TIMER = 0x20, + + /** With EVENT_BASE_FLAG_PRECISE_TIMER, + epoll backend will use timerfd for more accurate timers, this will + allows to disable this. + + That said that this is something in between lack of + (CLOCK_MONOTONIC_COARSE) and enabled EVENT_BASE_FLAG_PRECISE_TIMER + (CLOCK_MONOTONIC + timerfd). + + This flag has no effect if you wind up using a backend other than + epoll and if you do not have EVENT_BASE_FLAG_PRECISE_TIMER enabled. + */ + EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD = 0x40, }; /**