From: havoc Date: Thu, 23 Jan 2020 03:02:09 +0000 (+0000) Subject: Lower the default value of taskqueue_maxthreads from 32 to 4, as the threads are... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fcf0b55c39647e2927c1b374d5b926997e273d37;p=xonotic%2Fdarkplaces.git Lower the default value of taskqueue_maxthreads from 32 to 4, as the threads are just spinning - better solution coming. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12511 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/taskqueue.c b/taskqueue.c index b826100d..c30096c1 100644 --- a/taskqueue.c +++ b/taskqueue.c @@ -1,7 +1,7 @@ #include "quakedef.h" #include "taskqueue.h" -cvar_t taskqueue_maxthreads = {CVAR_CLIENT | CVAR_SERVER | CVAR_SAVE, "taskqueue_maxthreads", "32", "how many threads to use for executing tasks"}; +cvar_t taskqueue_maxthreads = {CVAR_CLIENT | CVAR_SERVER | CVAR_SAVE, "taskqueue_maxthreads", "4", "how many threads to use for executing tasks"}; typedef struct taskqueue_state_thread_s { @@ -162,7 +162,7 @@ void TaskQueue_Frame(qboolean shutdown) Thread_AtomicLock(&taskqueue_state.command_lock); taskqueue_state.threads_quit = 1; Thread_AtomicUnlock(&taskqueue_state.command_lock); - for (i = 0; i < taskqueue_state.numthreads; i++) + for (i = numthreads; i < taskqueue_state.numthreads; i++) { if (taskqueue_state.threads[i].handle) Thread_WaitThread(taskqueue_state.threads[i].handle, 0); @@ -172,7 +172,7 @@ void TaskQueue_Frame(qboolean shutdown) taskqueue_state.threads_quit = 0; Thread_AtomicUnlock(&taskqueue_state.command_lock); taskqueue_state.numthreads = numthreads; - for (i = 0; i < taskqueue_state.numthreads; i++) + for (i = taskqueue_state.numthreads; i < numthreads; i++) taskqueue_state.threads[i].handle = Thread_CreateThread(TaskQueue_ThreadFunc, &taskqueue_state.threads[i]); // if there are still pending tasks (e.g. no threads), execute them on main thread now TaskQueue_Execute(true);