mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-24 21:49:10 +00:00
threads: Move SDL's own thread creation to a new internal API.
This allows us to set an explicit stack size (overriding the system default and the global hint an app might have set), and remove all the macro salsa for dealing with _beginthreadex and such, as internal threads always set those to NULL anyhow. I've taken some guesses on reasonable (and tiny!) stack sizes for our internal threads, but some of these might turn out to be too small in practice and need an increase. Most of them are simple functions, though.
This commit is contained in:
parent
7ae2951fca
commit
c61675dc5d
13 changed files with 44 additions and 68 deletions
|
@ -24,7 +24,7 @@
|
|||
#include "SDL_timer_c.h"
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_cpuinfo.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "../thread/SDL_systhread.h"
|
||||
|
||||
/* #define DEBUG_TIMERS */
|
||||
|
||||
|
@ -221,17 +221,9 @@ SDL_TimerInit(void)
|
|||
}
|
||||
|
||||
SDL_AtomicSet(&data->active, 1);
|
||||
/* !!! FIXME: this is nasty. */
|
||||
#if defined(__WIN32__) && !defined(HAVE_LIBC)
|
||||
#undef SDL_CreateThread
|
||||
#if SDL_DYNAMIC_API
|
||||
data->thread = SDL_CreateThread_REAL(SDL_TimerThread, name, data, NULL, NULL);
|
||||
#else
|
||||
data->thread = SDL_CreateThread(SDL_TimerThread, name, data, NULL, NULL);
|
||||
#endif
|
||||
#else
|
||||
data->thread = SDL_CreateThread(SDL_TimerThread, name, data);
|
||||
#endif
|
||||
|
||||
/* Timer threads use a callback into the app, so we can't set a limited stack size here. */
|
||||
data->thread = SDL_CreateThreadInternal(SDL_TimerThread, name, 0, data);
|
||||
if (!data->thread) {
|
||||
SDL_TimerQuit();
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue