1
0
Mirror von https://github.com/tkuschel/bees.git synchronisiert 2026-06-19 06:57:54 +02:00

task: optimize for common case of single following Task

If there is only one Task in the post exec queue, we can
simply insert that Task instead of creating a task to hold
a post exec queue of one item.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
Dieser Commit ist enthalten in:
Zygo Blaxell
2021-06-08 00:34:35 -04:00
Ursprung ecf110f377
Commit b828f14dd1
+6 -1
Datei anzeigen
@@ -199,7 +199,11 @@ namespace crucible {
tlcc->m_local_queue.splice(tlcc->m_local_queue.begin(), queue);
} else {
// We are not executing under a TaskConsumer.
// Create a new task to wrap our post-exec queue,
// If there is only one task, then just insert it at the front of the queue.
if (queue.size() == 1) {
TaskMasterState::push_front(queue);
} else {
// If there are multiple tasks, create a new task to wrap our post-exec queue,
// then push it to the front of the global queue using normal locking methods.
TaskStatePtr rescue_task(make_shared<TaskState>("rescue_task", [](){}));
swap(rescue_task->m_post_exec_queue, queue);
@@ -207,6 +211,7 @@ namespace crucible {
TaskMasterState::push_front(tq_one);
}
}
}
TaskState::~TaskState()
{