Skip to content

Commit

Permalink
Still fighting with calling conventions in Cygwin/MingW/VisualC...
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 11, 2011
1 parent 954d682 commit f16a0c6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/thread/win32/SDL_systhread.c
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit f16a0c6

Please sign in to comment.