Simplified Windows RunThread().
authorRyan C. Gordon <icculus@icculus.org>
Tue, 20 Sep 2011 17:42:58 -0400
changeset 596217cadf0c466e
parent 5961 3bd7ed5f3895
child 5963 fe5d2285dffa
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
     1.1 --- a/src/thread/windows/SDL_systhread.c	Mon Sep 19 01:49:29 2011 -0400
     1.2 +++ b/src/thread/windows/SDL_systhread.c	Tue Sep 20 17:42:58 2011 -0400
     1.3 @@ -79,19 +79,12 @@
     1.4  RunThread(void *data)
     1.5  {
     1.6      pThreadStartParms pThreadParms = (pThreadStartParms) data;
     1.7 -    pfnSDL_CurrentEndThread pfnCurrentEndThread = NULL;
     1.8 -
     1.9 -    // Call the thread function!
    1.10 -    SDL_RunThread(pThreadParms->args);
    1.11 -
    1.12 -    // Get the current endthread we have to use!
    1.13 -    if (pThreadParms) {
    1.14 -        pfnCurrentEndThread = pThreadParms->pfnCurrentEndThread;
    1.15 -        SDL_free(pThreadParms);
    1.16 -    }
    1.17 -    // Call endthread!
    1.18 -    if (pfnCurrentEndThread)
    1.19 -        (*pfnCurrentEndThread) (0);
    1.20 +    pfnSDL_CurrentEndThread pfnEndThread = pThreadParms->pfnCurrentEndThread;
    1.21 +    void *args = pThreadParms->args;
    1.22 +    SDL_free(pThreadParms);
    1.23 +    SDL_RunThread(args);
    1.24 +    if (pfnEndThread != NULL)
    1.25 +        pfnEndThread(0);
    1.26      return (0);
    1.27  }
    1.28