summaryrefslogtreecommitdiff
path: root/evtp.c
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2014-04-03 08:50:29 +0200
committerYorhel <git@yorhel.nl>2014-04-03 08:50:29 +0200
commit77ecca991f6775668f7b4213fde7a7beb01575f4 (patch)
tree1ed0080b42e948cb3128990c52a2bb9268ca1a53 /evtp.c
parentcdeba6e7e187d6295b319337067e8c445a662a3f (diff)
evtp: Don't inherit signal mask in worker threads
Thanks to Marc Lehmann for pointing out this problem and suggesting the fix: http://lists.schmorp.de/pipermail/libev/2014q2/002368.html
Diffstat (limited to 'evtp.c')
-rw-r--r--evtp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/evtp.c b/evtp.c
index eade2d1..b5e2596 100644
--- a/evtp.c
+++ b/evtp.c
@@ -32,6 +32,7 @@
#include <errno.h>
#include <assert.h>
#include <pthread.h>
+#include <signal.h>
typedef struct evtp_queue_t {
@@ -161,11 +162,18 @@ static int evtp_spawn(evtp_t *tp) {
tp->kill--;
return 1;
}
- pthread_t thread;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ sigset_t fullset, oldset;
+ sigfillset(&fullset);
+
+ pthread_t thread;
+ pthread_sigmask(SIG_SETMASK, &fullset, &oldset);
int r = pthread_create(&thread, &attr, evtp_thread, tp);
+ pthread_sigmask(SIG_SETMASK, &oldset, NULL);
+
if(r) {
errno = r;
return tp->threads ? 0 : -1;