From f7a563946c0f0f555440c30f91608880c9ebce89 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 28 Sep 2008 11:56:57 +0000 Subject: 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 --- src/threadengines/threadengine_pthread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/threadengines') 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 +#include 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; -- cgit v1.2.3