From 3f740d6b2d4483d58d7222e1852fe7a5b621be33 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Tue, 7 Dec 2021 00:04:34 -0500 Subject: [PATCH] task: simplify clear_queue Simplify the loop in clear_queue because we can't be modifying a queue while we are clearing it. Signed-off-by: Zygo Blaxell --- lib/task.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/task.cc b/lib/task.cc index d97121c..a67f1db 100644 --- a/lib/task.cc +++ b/lib/task.cc @@ -254,9 +254,7 @@ namespace crucible { void TaskState::clear_queue(TaskQueue &tq) { - while (!tq.empty()) { - auto i = *tq.begin(); - tq.pop_front(); + for (auto &i : tq) { i->clear(); } }