]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Lower the default value of taskqueue_maxthreads from 32 to 4, as the threads are...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Jan 2020 03:02:09 +0000 (03:02 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Jan 2020 03:02:09 +0000 (03:02 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12511 d7cf8633-e32d-0410-b094-e92efae38249

taskqueue.c

index b826100da662b07d2c13e870b8144edf16f781b1..c30096c1027d43002e6ecb8a2d5ced86872b95e4 100644 (file)
@@ -1,7 +1,7 @@
 #include "quakedef.h"\r
 #include "taskqueue.h"\r
 \r
 #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
 \r
 typedef struct taskqueue_state_thread_s\r
 {\r
@@ -162,7 +162,7 @@ void TaskQueue_Frame(qboolean shutdown)
                Thread_AtomicLock(&taskqueue_state.command_lock);\r
                taskqueue_state.threads_quit = 1;\r
                Thread_AtomicUnlock(&taskqueue_state.command_lock);\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
                {\r
                        if (taskqueue_state.threads[i].handle)\r
                                Thread_WaitThread(taskqueue_state.threads[i].handle, 0);\r
@@ -172,7 +172,7 @@ void TaskQueue_Frame(qboolean shutdown)
                taskqueue_state.threads_quit = 0;\r
                Thread_AtomicUnlock(&taskqueue_state.command_lock);\r
                taskqueue_state.numthreads = numthreads;\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
                        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