diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-22 18:17:48 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-22 18:17:48 +0000 |
commit | 223e2c9a145abd09bb18c2cc17b94a77564b8b25 (patch) | |
tree | 8231df7394a5268e037b709e7db11f1a4d1359e1 /src | |
parent | 59c8e5d0644eab87ab7c8f21f8ca2eb1ae81a8da (diff) |
Forgot to initialize critical section. somehow, the new logging code exposed this error???
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9005 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/testsuite.cpp | 13 | ||||
-rw-r--r-- | src/threadengines/threadengine_win32.cpp | 10 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/testsuite.cpp b/src/testsuite.cpp index 14ea7ebed..02d806480 100644 --- a/src/testsuite.cpp +++ b/src/testsuite.cpp @@ -116,11 +116,18 @@ bool TestSuite::DoThreadTests() cout << "ThreadEngine::Create on TestSuiteThread...\n"; try { - te->Create(tst); + try + { + te->Create(tst); + } + catch (CoreException &ce) + { + cout << "Failure: " << ce.GetReason() << endl; + } } - catch (CoreException &ce) + catch (...) { - cout << "Failure: " << ce.GetReason() << endl; + cout << "Failure, unhandled exception\n"; } cout << "Type any line and press enter to end test.\n"; diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp index 792445b3e..4e3b472fb 100644 --- a/src/threadengines/threadengine_win32.cpp +++ b/src/threadengines/threadengine_win32.cpp @@ -18,6 +18,7 @@ CRITICAL_SECTION MyMutex; Win32ThreadEngine::Win32ThreadEngine(InspIRCd* Instance) : ThreadEngine(Instance) { + InitializeCriticalSection(&MyMutex); } void Win32ThreadEngine::Create(Thread* thread_to_init) @@ -25,22 +26,31 @@ void Win32ThreadEngine::Create(Thread* thread_to_init) Mutex(true); HANDLE* MyThread = new HANDLE; DWORD ThreadId = 0; + print ("1\n"); if (!(*MyThread = CreateThread(NULL,0,Win32ThreadEngine::Entry,this,0,&ThreadId))) { + printf ("2\n"); delete MyThread; + printf ("3\n"); Mutex(false); + printf ("4\n"); throw CoreException(std::string("Unable to reate new Win32ThreadEngine: ") + dlerror()); } + printf ("5\n"); NewThread = thread_to_init; NewThread->Creator = this; + printf ("6\n"); NewThread->Extend("winthread", MyThread); + printf ("7\n"); Mutex(false); + printf ("8\n"); } Win32ThreadEngine::~Win32ThreadEngine() { + DeleteCriticalSection(&MyMutex); } void Win32ThreadEngine::Run() |