mirror of
https://github.com/encounter/SDL.git
synced 2025-12-09 05:27:48 +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:
@@ -32,8 +32,8 @@
|
||||
#if SDL_MAC_NO_SANDBOX
|
||||
|
||||
#include "SDL_keyboard.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_cocoavideo.h"
|
||||
#include "../thread/SDL_systhread.h"
|
||||
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
|
||||
@@ -202,7 +202,7 @@ Cocoa_InitMouseEventTap(SDL_MouseData* driverdata)
|
||||
|
||||
tapdata->runloopStartedSemaphore = SDL_CreateSemaphore(0);
|
||||
if (tapdata->runloopStartedSemaphore) {
|
||||
tapdata->thread = SDL_CreateThread(&Cocoa_MouseTapThread, "Event Tap Loop", tapdata);
|
||||
tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 64 * 1024, tapdata);
|
||||
if (!tapdata->thread) {
|
||||
SDL_DestroySemaphore(tapdata->runloopStartedSemaphore);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
#include "SDL_pspvideo.h"
|
||||
#include "SDL_pspevents_c.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_keyboard.h"
|
||||
#include "../thread/SDL_systhread.h"
|
||||
#include <psphprm.h>
|
||||
|
||||
#ifdef PSPIRKEYB
|
||||
@@ -264,7 +264,7 @@ void PSP_EventInit(_THIS)
|
||||
return;
|
||||
}
|
||||
running = 1;
|
||||
if((thread = SDL_CreateThread(EventUpdate, "PSPInputThread",NULL)) == NULL) {
|
||||
if((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) {
|
||||
SDL_SetError("Can't create input thread\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ using Windows::UI::Core::CoreCursor;
|
||||
#include "../../core/winrt/SDL_winrtapp_xaml.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_system.h"
|
||||
#include "../thread/SDL_systhread.h"
|
||||
|
||||
extern "C" {
|
||||
#include "../SDL_sysvideo.h"
|
||||
@@ -113,7 +114,7 @@ WINRT_CycleXAMLThread()
|
||||
|
||||
_mutex = SDL_CreateMutex();
|
||||
_threadState = ThreadState_Running;
|
||||
_XAMLThread = SDL_CreateThread(WINRT_XAMLThreadMain, "SDL/XAML App Thread", nullptr);
|
||||
_XAMLThread = SDL_CreateThreadInternal(WINRT_XAMLThreadMain, "SDL/XAML App Thread", 0, nullptr);
|
||||
|
||||
SDL_LockMutex(_mutex);
|
||||
while (_threadState != ThreadState_Yielding) {
|
||||
|
||||
Reference in New Issue
Block a user