]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/threadengines/threadengine_pthread.cpp
Initialise SSL session pointer to NULL to prevent a potentially unsafe comparison...
[user/henk/code/inspircd.git] / src / threadengines / threadengine_pthread.cpp
index 2f09cc30556e7b4cfe189bf4ed675ecc6954963c..66898bf2524387c1138c23e9463529fbbaba4d95 100644 (file)
@@ -105,3 +105,29 @@ void PThreadEngine::FreeThread(Thread* thread)
        }
 }
 
+MutexFactory::MutexFactory(InspIRCd* Instance) : ServerInstance(Instance)
+{
+}
+
+Mutex* MutexFactory::CreateMutex()
+{
+       return new PosixMutex(this->ServerInstance);
+}
+
+PosixMutex::PosixMutex(InspIRCd* Instance) : Mutex(Instance)
+{
+       pthread_mutex_init(&putex, NULL);
+}
+
+PosixMutex::~PosixMutex()
+{
+       pthread_mutex_destroy(&putex);
+}
+
+void PosixMutex::Enable(bool enable)
+{
+       if (enable)
+               pthread_mutex_lock(&putex);
+       else
+               pthread_mutex_unlock(&putex);
+}