mirror of
https://github.com/encounter/SDL.git
synced 2025-06-15 02:53:31 +00:00
switch: increase thread stack size (fix a lot of stuff)
switch: enable load balancing across cores (@fincs)
This commit is contained in:
parent
2776779715
commit
a96c709351
@ -31,7 +31,7 @@
|
|||||||
#include "SDL_thread.h"
|
#include "SDL_thread.h"
|
||||||
#include "../SDL_systhread.h"
|
#include "../SDL_systhread.h"
|
||||||
|
|
||||||
#define STACK_SIZE 0x5000
|
#define STACK_SIZE 0x20000
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDL_SYS_RunThread(void *data)
|
SDL_SYS_RunThread(void *data)
|
||||||
@ -41,13 +41,28 @@ SDL_SYS_RunThread(void *data)
|
|||||||
|
|
||||||
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
|
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
|
||||||
{
|
{
|
||||||
Result res = threadCreate(&thread->handle, SDL_SYS_RunThread, args, STACK_SIZE, 0x2C, -2);
|
Result res;
|
||||||
if (res != 0) {
|
u64 core_mask = 0;
|
||||||
|
|
||||||
|
res = svcGetInfo(&core_mask, 0, CUR_PROCESS_HANDLE, 0);
|
||||||
|
if (R_FAILED(res)) {
|
||||||
|
return SDL_SetError("svcGetInfo() failed: 0x%08X", res);
|
||||||
|
}
|
||||||
|
|
||||||
|
res = threadCreate(&thread->handle, SDL_SYS_RunThread, args, STACK_SIZE, 0x2C, -2);
|
||||||
|
if (R_FAILED(res)) {
|
||||||
|
return SDL_SetError("threadCreate() failed: 0x%08X", res);
|
||||||
|
}
|
||||||
|
|
||||||
|
res = svcSetThreadCoreMask(thread->handle.handle, -1, (u32) core_mask);
|
||||||
|
if (R_FAILED(res)) {
|
||||||
|
threadClose(&thread->handle);
|
||||||
return SDL_SetError("threadCreate() failed: 0x%08X", res);
|
return SDL_SetError("threadCreate() failed: 0x%08X", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = threadStart(&thread->handle);
|
res = threadStart(&thread->handle);
|
||||||
if (res != 0) {
|
if (R_FAILED(res)) {
|
||||||
|
threadClose(&thread->handle);
|
||||||
return SDL_SetError("threadStart() failed: 0x%08X", res);
|
return SDL_SetError("threadStart() failed: 0x%08X", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user