From d619b8c4219f4f842d0b616d2cbb812f0d6fc678 Mon Sep 17 00:00:00 2001 From: Romaric Jodin Date: Mon, 13 Nov 2023 11:25:14 +0100 Subject: [PATCH] make sure main thread can extract from executor if possible --- src/queue.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/queue.cpp b/src/queue.cpp index 15f0e687..012975d8 100644 --- a/src/queue.cpp +++ b/src/queue.cpp @@ -371,6 +371,18 @@ cvk_executor_thread::extract_cmds_required_by(bool only_non_batch_cmds, } } if (executor_cmds->commands.size() > 0) { + // Make sure there is something to extract if possible for the main + // thread to avoid having the executor to signal the main thread to get + // to completion. + if (executor_cmds->commands.size() > 1) { + auto cmd = executor_cmds->commands.back(); + executor_cmds->commands.pop_back(); + m_groups.push_back(std::move(executor_cmds)); + queue->group_sent(); + + executor_cmds.reset(new cvk_command_group()); + executor_cmds->commands.push_front(cmd); + } m_groups.push_back(std::move(executor_cmds)); queue->group_sent(); }