diff --git a/libfreerdp-utils/thread.c b/libfreerdp-utils/thread.c index 4dfdd5936..d6b3b0b33 100644 --- a/libfreerdp-utils/thread.c +++ b/libfreerdp-utils/thread.c @@ -24,6 +24,9 @@ #ifdef _WIN32 #include +#ifdef _MSC_VER +#include +#endif #endif #include @@ -49,8 +52,11 @@ void freerdp_thread_start(freerdp_thread* thread, void* func, void* arg) #ifdef _WIN32 { - DWORD th; - CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, &th); +# ifdef _MSC_VER + CloseHandle((HANDLE)_beginthreadex(NULL, 0, func, arg, 0, NULL)); +#else + CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, NULL)); +#endif } #else {