include/SDL_thread.h
changeset 12317 d147224c0f28
parent 11952 d82e6e63c632
child 12318 69ebb2ebced0
     1.1 --- a/include/SDL_thread.h	Tue Oct 09 23:01:43 2018 -0700
     1.2 +++ b/include/SDL_thread.h	Thu Oct 11 16:40:01 2018 -0400
     1.3 @@ -106,14 +106,23 @@
     1.4                   pfnSDL_CurrentBeginThread pfnBeginThread,
     1.5                   pfnSDL_CurrentEndThread pfnEndThread);
     1.6  
     1.7 +extern DECLSPEC SDL_Thread *SDLCALL
     1.8 +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
     1.9 +                 const char *name, const size_t stacksize, void *data,
    1.10 +                 pfnSDL_CurrentBeginThread pfnBeginThread,
    1.11 +                 pfnSDL_CurrentEndThread pfnEndThread);
    1.12 +
    1.13 +
    1.14  /**
    1.15   *  Create a thread.
    1.16   */
    1.17  #if defined(SDL_CreateThread) && SDL_DYNAMIC_API
    1.18  #undef SDL_CreateThread
    1.19  #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
    1.20 +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
    1.21  #else
    1.22  #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
    1.23 +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
    1.24  #endif
    1.25  
    1.26  #elif defined(__OS2__)
    1.27 @@ -133,16 +142,31 @@
    1.28  SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
    1.29                   pfnSDL_CurrentBeginThread pfnBeginThread,
    1.30                   pfnSDL_CurrentEndThread pfnEndThread);
    1.31 +extern DECLSPEC SDL_Thread *SDLCALL
    1.32 +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
    1.33 +                 pfnSDL_CurrentBeginThread pfnBeginThread,
    1.34 +                 pfnSDL_CurrentEndThread pfnEndThread);
    1.35  #if defined(SDL_CreateThread) && SDL_DYNAMIC_API
    1.36  #undef SDL_CreateThread
    1.37  #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
    1.38 +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
    1.39  #else
    1.40  #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
    1.41 +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
    1.42  #endif
    1.43  
    1.44  #else
    1.45  
    1.46  /**
    1.47 + *  Create a thread with a default stack size.
    1.48 + *
    1.49 + *  This is equivalent to calling:
    1.50 + *  SDL_CreateThreadWithStackSize(fn, name, 0, data);
    1.51 + */
    1.52 +extern DECLSPEC SDL_Thread *SDLCALL
    1.53 +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
    1.54 +
    1.55 +/**
    1.56   *  Create a thread.
    1.57   *
    1.58   *   Thread naming is a little complicated: Most systems have very small
    1.59 @@ -159,9 +183,17 @@
    1.60   *   If a system imposes requirements, SDL will try to munge the string for
    1.61   *    it (truncate, etc), but the original string contents will be available
    1.62   *    from SDL_GetThreadName().
    1.63 + *
    1.64 + *   The size (in bytes) of the new stack can be specified. Zero means "use
    1.65 + *    the system default" which might be wildly different between platforms
    1.66 + *    (x86 Linux generally defaults to eight megabytes, an embedded device
    1.67 + *    might be a few kilobytes instead).
    1.68 + *
    1.69 + *   In SDL 2.1, stacksize will be folded into the original SDL_CreateThread
    1.70 + *    function.
    1.71   */
    1.72  extern DECLSPEC SDL_Thread *SDLCALL
    1.73 -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
    1.74 +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data);
    1.75  
    1.76  #endif
    1.77