mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-04 01:34:38 +00:00 
			
		
		
		
	Stack hint should look for 0, not -1, and not care about environment variables.
This commit is contained in:
		@@ -350,13 +350,12 @@ extern "C" {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
*  \brief  A string specifying SDL's threads stack size in bytes or "-1" for the backend's default size
 | 
			
		||||
*  \brief  A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
 | 
			
		||||
*
 | 
			
		||||
*  Use this hint in case you need to set SDL's threads stack size to other than the default.
 | 
			
		||||
*  This is specially useful if you build SDL against a non glibc libc library (such as musl) which
 | 
			
		||||
*  provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
 | 
			
		||||
*  Support for this hint is currenly available only in the pthread backend.
 | 
			
		||||
*  As a precaution, this hint can not be set via an environment variable.
 | 
			
		||||
*/
 | 
			
		||||
#define SDL_HINT_THREAD_STACK_SIZE              "SDL_THREAD_STACK_SIZE"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -107,7 +107,6 @@ SDL_SetMainReady(void)
 | 
			
		||||
int
 | 
			
		||||
SDL_InitSubSystem(Uint32 flags)
 | 
			
		||||
{
 | 
			
		||||
    static Uint32 hints_initialized = SDL_FALSE;
 | 
			
		||||
    if (!SDL_MainIsReady) {
 | 
			
		||||
        SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
 | 
			
		||||
        return -1;
 | 
			
		||||
@@ -116,13 +115,6 @@ SDL_InitSubSystem(Uint32 flags)
 | 
			
		||||
    /* Clear the error message */
 | 
			
		||||
    SDL_ClearError();
 | 
			
		||||
 | 
			
		||||
    if (hints_initialized == SDL_FALSE) {
 | 
			
		||||
        /* Set a default of -1 for SDL_HINT_THREAD_STACK_SIZE to prevent the
 | 
			
		||||
           end user from interfering it's value with environment variables */
 | 
			
		||||
        SDL_SetHintWithPriority(SDL_HINT_THREAD_STACK_SIZE, "-1", SDL_HINT_OVERRIDE);
 | 
			
		||||
        hints_initialized = SDL_TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if SDL_VIDEO_DRIVER_WINDOWS
 | 
			
		||||
	if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
 | 
			
		||||
		if (SDL_HelperWindowCreate() < 0) {
 | 
			
		||||
 
 | 
			
		||||
@@ -111,7 +111,10 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
 | 
			
		||||
    
 | 
			
		||||
    /* If the SDL_HINT_THREAD_STACK_SIZE exists and it seems to be a positive number, use it */
 | 
			
		||||
    if (hint && hint[0] >= '0' && hint[0] <= '9') {
 | 
			
		||||
        pthread_attr_setstacksize(&type, (size_t)SDL_atoi(hint));
 | 
			
		||||
        const size_t stacksize = (size_t) SDL_atoi(hint);
 | 
			
		||||
        if (stacksize > 0) {
 | 
			
		||||
            pthread_attr_setstacksize(&type, );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    pthread_attr_getstacksize(&type, &ss);
 | 
			
		||||
 
 | 
			
		||||
@@ -88,8 +88,6 @@ main(int argc, char *argv[])
 | 
			
		||||
        return (1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SDL_SetHintWithPriority(SDL_HINT_THREAD_STACK_SIZE, SDL_getenv(SDL_HINT_THREAD_STACK_SIZE), SDL_HINT_OVERRIDE);
 | 
			
		||||
 | 
			
		||||
    signal(SIGSEGV, SIG_DFL);
 | 
			
		||||
    for (i = 0; i < NUMTHREADS; i++) {
 | 
			
		||||
        char name[64];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user