]> git.xonotic.org Git - xonotic/darkplaces.git/commit
Redesigned TaskQueue to have a queue and distributor model so that threads can keep...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Jan 2020 08:19:11 +0000 (08:19 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Jan 2020 08:19:11 +0000 (08:19 +0000)
commit749072a8f60b88ef37448e224e83944b7096e909
tree510cc639860f0cd4ea0e97bd71df7de8d8a5e15d
parent315c3fd67ddabd747528bb200e6c690bec5d603c
Redesigned TaskQueue to have a queue and distributor model so that threads can keep their own queues of work to do without locking to check for more work.  Tasks are not executed until TaskQueue_WaitForTaskDone calls TaskQueue_DistributeTasks.

Added a fast path to TaskQueue_DistributeTasks for tasks that are waiting on other tasks to finish first, they are simply dequeued and re-enqueued immediately, and tend to just live on the distributor queue.

TaskQueue thread count is now dynamically adjusted based on tasks being queued per frame, and has a minimum and maximum thread count.

TaskQueue threads now sleep when idle, this may not be ideal, but did substantially lower the cpu usage so that it doesn't make other applications relatively unresponsive like it did before.

Removed taskqueue_task_t->started field and some other unused fields.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12513 d7cf8633-e32d-0410-b094-e92efae38249
r_shadow.c
taskqueue.c
taskqueue.h