diff options
Diffstat (limited to 'src/threadengines/threadengine_win32.cpp')
-rw-r--r-- | src/threadengines/threadengine_win32.cpp | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp index b32dd2441..6ebd6a10a 100644 --- a/src/threadengines/threadengine_win32.cpp +++ b/src/threadengines/threadengine_win32.cpp @@ -14,67 +14,40 @@ #include "inspircd.h" #include "threadengines/threadengine_win32.h" -Win32ThreadEngine::Win32ThreadEngine(InspIRCd* Instance) : ThreadEngine(Instance) +ThreadEngine::ThreadEngine(InspIRCd* Instance) { } -void Win32ThreadEngine::Create(Thread* thread) +void ThreadEngine::Create(Thread* thread) { - Win32ThreadData* data = new Win32ThreadData; + ThreadData* data = new ThreadData; thread->state = data; DWORD ThreadId = 0; - data->handle = CreateThread(NULL,0,Win32ThreadEngine::Entry,thread,0,&ThreadId); + data->handle = CreateThread(NULL,0,ThreadEngine::Entry,thread,0,&ThreadId); if (data->handle == NULL) { thread->state = NULL; delete data; - throw CoreException(std::string("Unable to create new Win32ThreadEngine: ") + dlerror()); + throw CoreException(std::string("Unable to create new thread: ") + dlerror()); } } -Win32ThreadEngine::~Win32ThreadEngine() +ThreadEngine::~ThreadEngine() { } -DWORD WINAPI Win32ThreadEngine::Entry(void* parameter) +DWORD WINAPI ThreadEngine::Entry(void* parameter) { Thread* pt = reinterpret_cast<Thread*>(parameter); pt->Run(); return 0; } -void Win32ThreadData::FreeThread(Thread* thread) +void ThreadData::FreeThread(Thread* thread) { thread->SetExitFlag(); WaitForSingleObject(handle,INFINITE); } - -MutexFactory::MutexFactory(InspIRCd* Instance) : ServerInstance(Instance) -{ -} - -Mutex* MutexFactory::CreateMutex() -{ - return new Win32Mutex(); -} - -Win32Mutex::Win32Mutex() : Mutex() -{ - InitializeCriticalSection(&wutex); -} - -Win32Mutex::~Win32Mutex() -{ - DeleteCriticalSection(&wutex); -} - -void Win32Mutex::Enable(bool enable) -{ - if (enable) - EnterCriticalSection(&wutex); - else - LeaveCriticalSection(&wutex); -} |