summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-31 06:05:29 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-31 06:05:29 +0200
commit73f7d5048c0e2ad4817ad208de02adee73938ed0 (patch)
tree1a292a82567eb49d3b0c9a8218d869528a994682 /src/fastd.c
parent6c656c7394bb972e81cd291b0ab126b2e73ce499 (diff)
downloadfastd-73f7d5048c0e2ad4817ad208de02adee73938ed0.tar
fastd-73f7d5048c0e2ad4817ad208de02adee73938ed0.zip
Unblock signals only during poll/epoll wait
If signals are normally blocked, we can avoid a lot of EINTR handling.
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/fastd.c b/src/fastd.c
index fc98ef5..c129a3c 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -96,6 +96,10 @@ static void on_sigchld(int signo UNUSED) {
static void init_signals(void) {
struct sigaction action;
+ sigset_t set, oldset;
+ sigfillset(&set);
+ pthread_sigmask(SIG_SETMASK, &set, &oldset);
+
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
@@ -629,10 +633,6 @@ static inline void reap_zombies(void) {
/** The \em real signal handlers */
static inline void handle_signals(void) {
- sigset_t set, oldset;
- sigfillset(&set);
- pthread_sigmask(SIG_SETMASK, &set, &oldset);
-
if (sighup) {
sighup = false;
@@ -651,8 +651,6 @@ static inline void handle_signals(void) {
sigchld = false;
reap_zombies();
}
-
- pthread_sigmask(SIG_SETMASK, &oldset, NULL);
}