summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-04-17 20:06:10 -0400
committerSean Bright <sean.bright@gmail.com>2017-04-24 12:46:27 -0400
commitcea3742c549a3c31621d2d29a1b78b42211e01d0 (patch)
tree10d3b39a433741922041fdbe0608d22e1905f1f9 /configure.ac
parentdac4442cdd787b58035fcd13d51abbf50a4d7cb3 (diff)
core: Use eventfd for alert pipes on Linux when possible
The primary win of switching to eventfd when possible is that it only uses a single file descriptor while pipe() will use two. This means for each bridge channel we're reducing the number of required file descriptors by 1, and - if you're using timerfd - we also now have 1 less file descriptor per Asterisk channel. The API is not ideal (passing int arrays), but this is the cleanest approach I could come up with to maintain API/ABI. I've also removed what I believe to be an erroneous code block that checked the non-blocking flag on the pipe ends for each read. If the file descriptor is 'losing' its non-blocking mode, it is because of a bug somewhere else in our code. In my testing I haven't seen any measurable difference in performance. Change-Id: Iff0fb1573e7f7a187d5211ddc60aa8f3da3edb1d
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 0458ce1a7..bf98ad386 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1098,6 +1098,15 @@ if test "${ac_cv_have_variable_fdset}x" = "0x"; then
AC_DEFINE([CONFIGURE_RAN_AS_ROOT], 1, [Some configure tests will unexpectedly fail if configure is run by a non-root user. These may be able to be tested at runtime.]))
fi
+AC_MSG_CHECKING([if we have usable eventfd support])
+AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([#include <sys/eventfd.h>],
+ [return eventfd(0, EFD_NONBLOCK | EFD_SEMAPHORE) == -1;])],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_EVENTFD], 1, [Define to 1 if your system supports eventfd and the EFD_NONBLOCK and EFD_SEMAPHORE flags.]),
+ AC_MSG_RESULT(no)
+)
+
AST_GCC_ATTRIBUTE(pure)
AST_GCC_ATTRIBUTE(malloc)
AST_GCC_ATTRIBUTE(const)