summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-28 11:56:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-28 11:56:57 +0000
commitf7a563946c0f0f555440c30f91608880c9ebce89 (patch)
tree6062fd06d46df303a4b5fb71a38b88154f28e890
parent546534d98ee6319453f5cab488241ba0f2525e4e (diff)
Suggested by nenolod, lets add this for thread signal safety
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10605 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/threadengines/threadengine_pthread.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp
index 66898bf25..69b900c5b 100644
--- a/src/threadengines/threadengine_pthread.cpp
+++ b/src/threadengines/threadengine_pthread.cpp
@@ -14,6 +14,7 @@
#include "inspircd.h"
#include "threadengines/threadengine_pthread.h"
#include <pthread.h>
+#include <signal.h>
pthread_mutex_t MyMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -87,6 +88,13 @@ bool PThreadEngine::Mutex(bool enable)
void* PThreadEngine::Entry(void* parameter)
{
+ /* Recommended by nenolod, signal safety on a per-thread basis */
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set, SIGPIPE);
+ if(pthread_sigmask(SIG_BLOCK, &set, NULL))
+ signal(SIGPIPE, SIG_IGN);
+
ThreadEngine * pt = (ThreadEngine*)parameter;
pt->Run();
return NULL;