diff --git a/libs/TaskQueue.h b/libs/TaskQueue.h index 23ee854a24..4c5ea33bc3 100644 --- a/libs/TaskQueue.h +++ b/libs/TaskQueue.h @@ -39,15 +39,20 @@ class TaskQueue } } + // Removes all tasks that have not been processed yet + // Doesn't affect the currently running one + void clearPendingTasks() + { + // Lock the queue and remove any tasks such that no new ones are added + std::lock_guard lock(_queueLock); + _queue.clear(); + } + // Clears the queue. This might block waiting for any currently - // active taks to finish + // active task to finish void clear() { - { - // Lock the queue and remove any tasks such that no new ones are added - std::lock_guard lock(_queueLock); - _queue.clear(); - } + clearPendingTasks(); _current = std::future(); _finished = std::future();