mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
[LIBNX] Threading; Use a ThreadCoreMask and let the system schedule it.
This commit is contained in:
parent
95974f9f3a
commit
72ed1c0b82
@ -66,18 +66,27 @@ static uint32_t threadCounter = 1;
|
||||
int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
|
||||
{
|
||||
u32 prio = 0;
|
||||
u64 core_mask = 0;
|
||||
|
||||
Thread new_switch_thread;
|
||||
|
||||
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
|
||||
svcGetInfo(&core_mask, 0, CUR_PROCESS_HANDLE, 0);
|
||||
|
||||
// Launch threads on Core 1
|
||||
int rc = threadCreate(&new_switch_thread, (void (*)(void *))start_routine, arg, STACKSIZE, prio - 1, 1);
|
||||
int rc = threadCreate(&new_switch_thread, (void (*)(void *))start_routine, arg, STACKSIZE, prio - 1, -2);
|
||||
|
||||
if (R_FAILED(rc))
|
||||
{
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
rc = svcSetThreadCoreMask(new_switch_thread.handle, -1, core_mask);
|
||||
if (R_FAILED(rc))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("[Threading]: Starting Thread(#%i)\n", threadCounter);
|
||||
if (R_FAILED(threadStart(&new_switch_thread)))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user