aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarlson2k <k2k@narod.ru>2015-01-21 21:21:16 +0300
committerKarlson2k <k2k@narod.ru>2015-02-15 17:21:48 +0300
commite951fe9c6979fe1d9690153dc97e70fbfcc6bef3 (patch)
treeb23dacd387411de359283233f1a0d66db56bbdc9
parentd8111f8851fea2cb12b02cdaa7dc817220330637 (diff)
[win32] Use _beginthreadex() instead of CreateThread() for better compatibility with CRT functions
-rw-r--r--xbmc/threads/platform/win/ThreadImpl.cpp5
-rw-r--r--xbmc/threads/platform/win/ThreadImpl.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/xbmc/threads/platform/win/ThreadImpl.cpp b/xbmc/threads/platform/win/ThreadImpl.cpp
index 76b60fa83e..2f1c66ac3c 100644
--- a/xbmc/threads/platform/win/ThreadImpl.cpp
+++ b/xbmc/threads/platform/win/ThreadImpl.cpp
@@ -19,18 +19,21 @@
*/
#include <windows.h>
+#include <process.h>
#include "threads/platform/win/Win32Exception.h"
void CThread::SpawnThread(unsigned stacksize)
{
// Create in the suspended state, so that no matter the thread priorities and scheduled order, the handle will be assigned
// before the new thread exits.
- m_ThreadOpaque.handle = CreateThread(NULL, stacksize, (LPTHREAD_START_ROUTINE)&staticThread, this, CREATE_SUSPENDED, &m_ThreadId);
+ unsigned threadId;
+ m_ThreadOpaque.handle = (HANDLE)_beginthreadex(NULL, stacksize, &staticThread, this, CREATE_SUSPENDED, &threadId);
if (m_ThreadOpaque.handle == NULL)
{
if (logger) logger->Log(LOGERROR, "%s - fatal error %d creating thread", __FUNCTION__, GetLastError());
return;
}
+ m_ThreadId = threadId;
if (ResumeThread(m_ThreadOpaque.handle) == -1)
if (logger) logger->Log(LOGERROR, "%s - fatal error %d resuming thread", __FUNCTION__, GetLastError());
diff --git a/xbmc/threads/platform/win/ThreadImpl.h b/xbmc/threads/platform/win/ThreadImpl.h
index ca423e737c..b670df3cb2 100644
--- a/xbmc/threads/platform/win/ThreadImpl.h
+++ b/xbmc/threads/platform/win/ThreadImpl.h
@@ -30,7 +30,7 @@ struct threadOpaque
typedef DWORD ThreadIdentifier;
typedef threadOpaque ThreadOpaque;
-typedef DWORD THREADFUNC;
+#define THREADFUNC unsigned __stdcall
namespace XbmcThreads
{