summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-05-12 17:49:19 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-05-12 17:49:19 +0200
commite285cfb2219eb5a1034208efaf6d1a2d875c721f (patch)
tree9afe5801c49c07e67a6fd262d866b39bacf66708
parentae6f684d830871e81b0b4168424f6a4873eabbff (diff)
free SIGALRM for boost timers
Change-Id: Ib6825c21b6589db6c7e9b8c5a179c347bcc0a93d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-hsrv.c2
-rw-r--r--src/sig-monitor.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/afb-hsrv.c b/src/afb-hsrv.c
index 51502a64..d06d8fc2 100644
--- a/src/afb-hsrv.c
+++ b/src/afb-hsrv.c
@@ -238,8 +238,8 @@ static void end_handler(void *cls, struct MHD_Connection *connection, void **rec
static void do_run(int signum, void *arg)
{
MHD_UNSIGNED_LONG_LONG to;
-
struct afb_hsrv *hsrv = arg;
+
if (!signum) {
do { MHD_run(hsrv->httpd); } while(MHD_get_timeout(hsrv->httpd, &to) == MHD_YES && !to);
}
diff --git a/src/sig-monitor.c b/src/sig-monitor.c
index 3e16f720..1e519351 100644
--- a/src/sig-monitor.c
+++ b/src/sig-monitor.c
@@ -28,6 +28,8 @@
#include "sig-monitor.h"
#include "verbose.h"
+#define SIG_FOR_TIMER (SIGVTALRM+2)
+
/* local handler */
static _Thread_local sigjmp_buf *error_handler;
@@ -49,7 +51,7 @@ static inline int timeout_create()
rc = 0;
else {
sevp.sigev_notify = SIGEV_THREAD_ID;
- sevp.sigev_signo = SIGALRM;
+ sevp.sigev_signo = SIG_FOR_TIMER;
sevp.sigev_value.sival_ptr = NULL;
#if defined(sigev_notify_thread_id)
sevp.sigev_notify_thread_id = (pid_t)syscall(SYS_gettid);
@@ -124,7 +126,7 @@ static void on_signal_error(int signum)
sigprocmask(SIG_UNBLOCK, &sigset, 0);
longjmp(*error_handler, signum);
}
- if (signum == SIGALRM)
+ if (signum == SIG_FOR_TIMER)
return;
ERROR("Unmonitored signal %d received: %s", signum, strsignal(signum));
exit(2);
@@ -146,7 +148,7 @@ static int install(void (*handler)(int), int *signals)
int sig_monitor_init()
{
- static int sigerr[] = { SIGALRM, SIGSEGV, SIGFPE, 0 };
+ static int sigerr[] = { SIG_FOR_TIMER, SIGSEGV, SIGFPE, 0 };
static int sigterm[] = { SIGINT, SIGABRT, 0 };
return (install(on_signal_error, sigerr) & install(on_signal_terminate, sigterm)) - 1;