Still fighting with calling conventions in Cygwin/MingW/VisualC... SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Sun, 11 Sep 2011 15:24:44 -0400
branchSDL-1.2
changeset 5896157ed9eff378
parent 5895 402eac854030
child 5897 90faab009401
Still fighting with calling conventions in Cygwin/MingW/VisualC...
src/thread/win32/SDL_systhread.c
     1.1 --- a/src/thread/win32/SDL_systhread.c	Sun Sep 11 14:44:37 2011 -0400
     1.2 +++ b/src/thread/win32/SDL_systhread.c	Sun Sep 11 15:24:44 2011 -0400
     1.3 @@ -60,7 +60,7 @@
     1.4    pfnSDL_CurrentEndThread pfnCurrentEndThread;
     1.5  } tThreadStartParms, *pThreadStartParms;
     1.6  
     1.7 -static DWORD WINAPI RunThread(LPVOID data)
     1.8 +static DWORD RunThread(void *data)
     1.9  {
    1.10    pThreadStartParms pThreadParms = (pThreadStartParms)data;
    1.11    pfnSDL_CurrentEndThread pfnCurrentEndThread = NULL;
    1.12 @@ -80,6 +80,16 @@
    1.13    return(0);
    1.14  }
    1.15  
    1.16 +static DWORD WINAPI RunThreadViaCreateThread(LPVOID data)
    1.17 +{
    1.18 +  return RunThread(data);
    1.19 +}
    1.20 +
    1.21 +static unsigned __stdcall RunThreadViaBeginThreadEx(void *data)
    1.22 +{
    1.23 +  return (unsigned) RunThread(data);
    1.24 +}
    1.25 +
    1.26  #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
    1.27  int SDL_SYS_CreateThread(SDL_Thread *thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
    1.28  {
    1.29 @@ -108,11 +118,11 @@
    1.30  	if (pfnBeginThread) {
    1.31  		unsigned threadid = 0;
    1.32  		thread->handle = (SYS_ThreadHandle)
    1.33 -				((size_t) pfnBeginThread(NULL, 0, RunThread,
    1.34 +				((size_t) pfnBeginThread(NULL, 0, RunThreadViaBeginThreadEx,
    1.35  										 pThreadParms, 0, &threadid));
    1.36  	} else {
    1.37  		DWORD threadid = 0;
    1.38 -		thread->handle = CreateThread(NULL, 0, RunThread, pThreadParms, 0, &threadid);
    1.39 +		thread->handle = CreateThread(NULL, 0, RunThreadViaCreateThread, pThreadParms, 0, &threadid);
    1.40  	}
    1.41  	if (thread->handle == NULL) {
    1.42  		SDL_SetError("Not enough resources to create thread");