From 10af1cb104420d9f3148bccf0c988ca27e600ac5 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov.dev@gmail.com> Date: Fri, 30 Mar 2018 11:33:57 +0300 Subject: [PATCH] libev: use clock_gettime on OS X if available EV_USE_REALTIME and EV_USE_MONOTONIC, which force libev to use clock_gettime, are enabled automatically on Linux, but not on OS X. We used to forcefully enable them for performance reasons, but this broke compilation on certain OS X versions and so was disabled by commit d36ba2796839 ("Fix gh-1777: clock_gettime detected but unavailable in macos"). Today we need these features enabled not just because of performance, but also to avoid crashes when time changes on the host - see issue #2527 and commit a6c87bf9ac99 ("Use ev_monotonic_now/time instead of ev_now/time for timeouts"). Fortunately, we have this cmake defined macro HAVE_CLOCKGETTIME_DECL, which is set if clock_gettime is available. Let's enable EV_USE_REALTIME and EV_USE_MONOTONIC if this macro is defined. Closes #3299 --- third_party/tarantool_ev.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/third_party/tarantool_ev.h b/third_party/tarantool_ev.h index 5ec22ff6a2..2fea76e6b5 100644 --- a/third_party/tarantool_ev.h +++ b/third_party/tarantool_ev.h @@ -48,6 +48,10 @@ #define EV_FORK_ENABLE 1 #define EV_CONFIG_H 0 #define EV_USE_FLOOR 1 +#ifdef HAVE_CLOCK_GETTIME_DECL +# define EV_USE_REALTIME 1 +# define EV_USE_MONOTONIC 1 +#endif #include "third_party/libev/ev.h" #else /* !defined(ENABLE_BUNDLED_LIBEV) */ #include <ev.h> -- GitLab