]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/threadengines/threadengine_pthread.cpp
Rework /MAP output to not be overly wide
[user/henk/code/inspircd.git] / src / threadengines / threadengine_pthread.cpp
index a1993af4548643df4e2a45b71bce11457c998564..15f5567a4a90d2609d30177168417e4f5443c4fe 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -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;
@@ -105,11 +113,11 @@ void PThreadEngine::FreeThread(Thread* thread)
        }
 }
 
-MutexEngine::MutexEngine(InspIRCd* Instance) : ServerInstance(Instance)
+MutexFactory::MutexFactory(InspIRCd* Instance) : ServerInstance(Instance)
 {
 }
 
-Mutex* MutexEngine::CreateMutex()
+Mutex* MutexFactory::CreateMutex()
 {
        return new PosixMutex(this->ServerInstance);
 }