diff options
Diffstat (limited to 'src/threadengines/threadengine_pthread.cpp')
-rw-r--r-- | src/threadengines/threadengine_pthread.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp index 2f09cc305..626cd4d55 100644 --- a/src/threadengines/threadengine_pthread.cpp +++ b/src/threadengines/threadengine_pthread.cpp @@ -105,3 +105,29 @@ void PThreadEngine::FreeThread(Thread* thread) } } +MutexEngine::MutexEngine(InspIRCd* Instance) : ServerInstance(Instance) +{ +} + +Mutex* MutexEngine::CreateMutex() +{ + return new PosixMutex(this->ServerInstance); +} + +PosixMutex::PosixMutex(InspIRCd* Instance) : Mutex(Instance) +{ + InitializeCriticalSection(&putex); +} + +PosixMutex::~PosixMutex() +{ + DeleteCriticalSection(&putex); +} + +void PosixMutex::Enable(bool enable) +{ + if (enable) + pthread_mutex_lock(&putex); + else + pthread_mutex_unlock(&putex); +} |