From 9bfb4f19ce78c755ea808167cea45753000da502 Mon Sep 17 00:00:00 2001 From: Weijia Jiang Date: Wed, 13 Sep 2023 22:19:14 +0800 Subject: [PATCH] fix iterate in close_and_shutdown --- tokio/src/runtime/task/list.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tokio/src/runtime/task/list.rs b/tokio/src/runtime/task/list.rs index 66d6f29d57c..291faebe3ec 100644 --- a/tokio/src/runtime/task/list.rs +++ b/tokio/src/runtime/task/list.rs @@ -154,15 +154,10 @@ impl OwnedTasks { self.closed.fetch_and(true, Ordering::Release); for i in 0..self.lists.len() { - let first_task = self.pop_back_inner(i); - match first_task { - Some(task) => task.shutdown(), - None => return, - } loop { let task = match self.pop_back_inner(i) { Some(task) => task, - None => return, + None => continue, }; task.shutdown(); }