X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fthreadengines%2Fthreadengine_win32.cpp;h=ea37892f8d9c0d239ca1b1aa485f590a230b4fcf;hb=748b3a0d89e7ecc9a766471b79fb78f63a5ca2bb;hp=637a3e01093877d75063c049aadd668afb4c34f5;hpb=c05ad37bfd03486475889485606ed5cffc7bf5a2;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp index 637a3e010..ea37892f8 100644 --- a/src/threadengines/threadengine_win32.cpp +++ b/src/threadengines/threadengine_win32.cpp @@ -35,17 +35,11 @@ void ThreadEngine::Start(Thread* thread) if (data->handle == NULL) { + DWORD lasterr = GetLastError(); thread->state = NULL; delete data; - std::string err = "Unable to create new thread: "; -#ifdef _WIN32 - CHAR errdetail[100]; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), errdetail, 100, 0); + std::string err = "Unable to create new thread: " + ConvToStr(lasterr); SetLastError(ERROR_SUCCESS); - err += errdetail; -#else - err += dlerror(); -#endif throw CoreException(err); } } @@ -65,6 +59,7 @@ void ThreadData::FreeThread(Thread* thread) { thread->SetExitFlag(); WaitForSingleObject(handle,INFINITE); + CloseHandle(handle); } class ThreadSignalSocket : public BufferedSocket