From 9613ccbde36a09906ea0383523770592fdc379b5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 20 Sep 2011 17:42:58 -0400 Subject: [PATCH] Simplified Windows RunThread(). Removed checks for things that are always true, free unneeded struct before calling thread entry point, instead of after thread completes. --- src/thread/windows/SDL_systhread.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c index a1a5a597a..f4f1ca333 100644 --- a/src/thread/windows/SDL_systhread.c +++ b/src/thread/windows/SDL_systhread.c @@ -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); }