]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/threadengines/threadengine_win32.cpp
Merge pull request #1148 from guikcd/spelling-error
[user/henk/code/inspircd.git] / src / threadengines / threadengine_win32.cpp
index 3e643c6f5aec175ec8102379d2b59f70073f23a4..ea37892f8d9c0d239ca1b1aa485f590a230b4fcf 100644 (file)
@@ -35,9 +35,12 @@ void ThreadEngine::Start(Thread* thread)
 
        if (data->handle == NULL)
        {
+               DWORD lasterr = GetLastError();
                thread->state = NULL;
                delete data;
-               throw CoreException(std::string("Unable to create new thread: ") + dlerror());
+               std::string err = "Unable to create new thread: " + ConvToStr(lasterr);
+               SetLastError(ERROR_SUCCESS);
+               throw CoreException(err);
        }
 }
 
@@ -56,6 +59,7 @@ void ThreadData::FreeThread(Thread* thread)
 {
        thread->SetExitFlag();
        WaitForSingleObject(handle,INFINITE);
+       CloseHandle(handle);
 }
 
 class ThreadSignalSocket : public BufferedSocket