#include "quakedef.h"\r
#include "taskqueue.h"\r
\r
-cvar_t taskqueue_maxthreads = {CVAR_CLIENT | CVAR_SERVER | CVAR_SAVE, "taskqueue_maxthreads", "32", "how many threads to use for executing tasks"};\r
+cvar_t taskqueue_maxthreads = {CVAR_CLIENT | CVAR_SERVER | CVAR_SAVE, "taskqueue_maxthreads", "4", "how many threads to use for executing tasks"};\r
\r
typedef struct taskqueue_state_thread_s\r
{\r
Thread_AtomicLock(&taskqueue_state.command_lock);\r
taskqueue_state.threads_quit = 1;\r
Thread_AtomicUnlock(&taskqueue_state.command_lock);\r
- for (i = 0; i < taskqueue_state.numthreads; i++)\r
+ for (i = numthreads; i < taskqueue_state.numthreads; i++)\r
{\r
if (taskqueue_state.threads[i].handle)\r
Thread_WaitThread(taskqueue_state.threads[i].handle, 0);\r
taskqueue_state.threads_quit = 0;\r
Thread_AtomicUnlock(&taskqueue_state.command_lock);\r
taskqueue_state.numthreads = numthreads;\r
- for (i = 0; i < taskqueue_state.numthreads; i++)\r
+ for (i = taskqueue_state.numthreads; i < numthreads; i++)\r
taskqueue_state.threads[i].handle = Thread_CreateThread(TaskQueue_ThreadFunc, &taskqueue_state.threads[i]);\r
// if there are still pending tasks (e.g. no threads), execute them on main thread now\r
TaskQueue_Execute(true);\r