From 07f5929948a9aa86b2eb0199d16a6691f4f6a404 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 11 Sep 2011 15:24:44 -0400 Subject: [PATCH] Still fighting with calling conventions in Cygwin/MingW/VisualC... --HG-- branch : SDL-1.2 --- src/thread/win32/SDL_systhread.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/thread/win32/SDL_systhread.c b/src/thread/win32/SDL_systhread.c index 73238422a..ed7e1f62c 100644 --- a/src/thread/win32/SDL_systhread.c +++ b/src/thread/win32/SDL_systhread.c @@ -60,7 +60,7 @@ typedef struct ThreadStartParms pfnSDL_CurrentEndThread pfnCurrentEndThread; } tThreadStartParms, *pThreadStartParms; -static DWORD WINAPI RunThread(LPVOID data) +static DWORD RunThread(void *data) { pThreadStartParms pThreadParms = (pThreadStartParms)data; pfnSDL_CurrentEndThread pfnCurrentEndThread = NULL; @@ -80,6 +80,16 @@ static DWORD WINAPI RunThread(LPVOID data) return(0); } +static DWORD WINAPI RunThreadViaCreateThread(LPVOID data) +{ + return RunThread(data); +} + +static unsigned __stdcall RunThreadViaBeginThreadEx(void *data) +{ + return (unsigned) RunThread(data); +} + #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD int SDL_SYS_CreateThread(SDL_Thread *thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread) { @@ -108,11 +118,11 @@ int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) if (pfnBeginThread) { unsigned threadid = 0; thread->handle = (SYS_ThreadHandle) - ((size_t) pfnBeginThread(NULL, 0, RunThread, + ((size_t) pfnBeginThread(NULL, 0, RunThreadViaBeginThreadEx, pThreadParms, 0, &threadid)); } else { DWORD threadid = 0; - thread->handle = CreateThread(NULL, 0, RunThread, pThreadParms, 0, &threadid); + thread->handle = CreateThread(NULL, 0, RunThreadViaCreateThread, pThreadParms, 0, &threadid); } if (thread->handle == NULL) { SDL_SetError("Not enough resources to create thread");