From 6706a35f4ec0ff22b2251b6728264e082c4d6270 Mon Sep 17 00:00:00 2001 From: Weijia Jiang Date: Sat, 23 Sep 2023 00:09:06 +0800 Subject: [PATCH] add comments for parameter in OwnedTasks.close_and_shutdown_all --- tokio/src/runtime/task/list.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tokio/src/runtime/task/list.rs b/tokio/src/runtime/task/list.rs index 082c8c37215..a8ef5e43689 100644 --- a/tokio/src/runtime/task/list.rs +++ b/tokio/src/runtime/task/list.rs @@ -146,6 +146,10 @@ impl OwnedTasks { /// Shuts down all tasks in the collection. This call also closes the /// collection, preventing new items from being added. + /// The parameter start should be random among different worker threads + /// to reduce lock conflicts during shutdown. + /// Initiate shutting down the segment indexed by the start, and reset to 0 + /// once the segment_size is reached, continuing until start - 1, it works like a ring. pub(crate) fn close_and_shutdown_all(&self, start: usize) where S: Schedule,