Move the taskqueue_state.numthreads update so that the creation loop works again.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Jan 2020 03:03:44 +0000 (03:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Jan 2020 03:03:44 +0000 (03:03 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12512 d7cf8633-e32d-0410-b094-e92efae38249

taskqueue.c

index c30096c..710a40e 100644 (file)
@@ -171,9 +171,9 @@ void TaskQueue_Frame(qboolean shutdown)
                Thread_AtomicLock(&taskqueue_state.command_lock);\r
                taskqueue_state.threads_quit = 0;\r
                Thread_AtomicUnlock(&taskqueue_state.command_lock);\r
                Thread_AtomicLock(&taskqueue_state.command_lock);\r
                taskqueue_state.threads_quit = 0;\r
                Thread_AtomicUnlock(&taskqueue_state.command_lock);\r
-               taskqueue_state.numthreads = numthreads;\r
                for (i = taskqueue_state.numthreads; i < numthreads; i++)\r
                        taskqueue_state.threads[i].handle = Thread_CreateThread(TaskQueue_ThreadFunc, &taskqueue_state.threads[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
+               taskqueue_state.numthreads = numthreads;\r
                // if there are still pending tasks (e.g. no threads), execute them on main thread now\r
                TaskQueue_Execute(true);\r
        }\r
                // if there are still pending tasks (e.g. no threads), execute them on main thread now\r
                TaskQueue_Execute(true);\r
        }\r