Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Simplified Windows RunThread().
Browse files Browse the repository at this point in the history
Removed checks for things that are always true, free unneeded struct before
 calling thread entry point, instead of after thread completes.
  • Loading branch information
icculus committed Sep 20, 2011
1 parent 4dc7286 commit 9613ccb
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/thread/windows/SDL_systhread.c
Expand Up @@ -79,19 +79,12 @@ static DWORD
RunThread(void *data)
{
pThreadStartParms pThreadParms = (pThreadStartParms) data;
pfnSDL_CurrentEndThread pfnCurrentEndThread = NULL;

// Call the thread function!
SDL_RunThread(pThreadParms->args);

// Get the current endthread we have to use!
if (pThreadParms) {
pfnCurrentEndThread = pThreadParms->pfnCurrentEndThread;
SDL_free(pThreadParms);
}
// Call endthread!
if (pfnCurrentEndThread)
(*pfnCurrentEndThread) (0);
pfnSDL_CurrentEndThread pfnEndThread = pThreadParms->pfnCurrentEndThread;
void *args = pThreadParms->args;
SDL_free(pThreadParms);
SDL_RunThread(args);
if (pfnEndThread != NULL)
pfnEndThread(0);
return (0);
}

Expand Down

0 comments on commit 9613ccb

Please sign in to comment.