summaryrefslogtreecommitdiff
path: root/main/utils.c
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 11:50:09 -0500
commit59203c51cc6a9676ef1ab42aebe070a55f55ead2 (patch)
tree474f8136a9a10ee4720c58e4a9d9dc2b6015f03a /main/utils.c
parentdc6654d969224129bdd7b4080eda6e027c6454b9 (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 'main/utils.c')
-rw-r--r--main/utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c
index 2033664b8..c254db520 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -67,6 +67,9 @@
#define AST_API_MODULE
#include "asterisk/config.h"
+#define AST_API_MODULE
+#include "asterisk/alertpipe.h"
+
static char base64[64];
static char b2a[256];