Browse Source

Removed SDL_HINT_THREAD_STACK_SIZE

The stack size can be specified using SDL_CreateThreadWithStackSize()
Sam Lantinga 1 year ago
parent
commit
9920e062d5
3 changed files with 4 additions and 32 deletions
  1. 2 1
      docs/README-migration.md
  2. 0 14
      include/SDL3/SDL_hints.h
  3. 2 17
      src/thread/SDL_thread.c

+ 2 - 1
docs/README-migration.md

@@ -710,14 +710,15 @@ The following hints have been removed:
 * SDL_HINT_MOUSE_RELATIVE_SCALING - mouse coordinates are no longer automatically scaled by the SDL renderer
 * SDL_HINT_RENDER_BATCHING - Render batching is always enabled, apps should call SDL_FlushRenderer() before calling into a lower-level graphics API.
 * SDL_HINT_RENDER_LOGICAL_SIZE_MODE - the logical size mode is explicitly set with SDL_SetRenderLogicalPresentation()
+* SDL_HINT_THREAD_STACK_SIZE - the stack size can be specified using SDL_CreateThreadWithStackSize()
 * SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL - replaced with the "opengl" property in SDL_CreateWindowWithProperties()
 * SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN - replaced with the "vulkan" property in SDL_CreateWindowWithProperties()
 * SDL_HINT_VIDEO_HIGHDPI_DISABLED - high DPI support is always enabled
 * SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT - replaced with the "win32.pixel_format_hwnd" in SDL_CreateWindowWithProperties()
-* SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING - SDL now properly handles the 0x406D1388 Exception if no debugger intercepts it, preventing its propagation.
 * SDL_HINT_VIDEO_X11_FORCE_EGL - use SDL_HINT_VIDEO_FORCE_EGL instead
 * SDL_HINT_VIDEO_X11_XINERAMA - Xinerama no longer supported by the X11 backend
 * SDL_HINT_VIDEO_X11_XVIDMODE - Xvidmode no longer supported by the X11 backend
+* SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING - SDL now properly handles the 0x406D1388 Exception if no debugger intercepts it, preventing its propagation.
 * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING
 
 * Renamed hints SDL_HINT_VIDEODRIVER and SDL_HINT_AUDIODRIVER to SDL_HINT_VIDEO_DRIVER and SDL_HINT_AUDIO_DRIVER

+ 0 - 14
include/SDL3/SDL_hints.h

@@ -1917,20 +1917,6 @@ extern "C" {
  */
 #define SDL_HINT_THREAD_PRIORITY_POLICY         "SDL_THREAD_PRIORITY_POLICY"
 
-/**
-*  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 currently available only in the pthread, Windows, and PSP backend.
-*
-*  Instead of this hint, in 2.0.9 and later, you can use
-*  SDL_CreateThreadWithStackSize(). This hint only works with the classic
-*  SDL_CreateThread().
-*/
-#define SDL_HINT_THREAD_STACK_SIZE              "SDL_THREAD_STACK_SIZE"
-
 /**
  * A variable that controls the timer resolution, in milliseconds.
  *

+ 2 - 17
src/thread/SDL_thread.c

@@ -378,25 +378,10 @@ DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int(SDLCALL *fn)(void *),
                  const char *name, void *data)
 #endif
 {
-    /* !!! FIXME: in 2.1, just make stackhint part of the usual API. */
-    const char *stackhint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE);
-    size_t stacksize = 0;
-
-    /* If the SDL_HINT_THREAD_STACK_SIZE exists, use it */
-    if (stackhint) {
-        char *endp = NULL;
-        const Sint64 hintval = SDL_strtoll(stackhint, &endp, 10);
-        if ((*stackhint != '\0') && (*endp == '\0')) { /* a valid number? */
-            if (hintval > 0) {                         /* reject bogus values. */
-                stacksize = (size_t)hintval;
-            }
-        }
-    }
-
 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
-    return SDL_CreateThreadWithStackSize(fn, name, stacksize, data, pfnBeginThread, pfnEndThread);
+    return SDL_CreateThreadWithStackSize(fn, name, 0, data, pfnBeginThread, pfnEndThread);
 #else
-    return SDL_CreateThreadWithStackSize(fn, name, stacksize, data);
+    return SDL_CreateThreadWithStackSize(fn, name, 0, data);
 #endif
 }