From ea91b33ca57ff0581b38e735cc108f831bccbdaa Mon Sep 17 00:00:00 2001 From: K-tecchan <67850755+K-tecchan@users.noreply.github.com> Date: Thu, 20 Aug 2026 15:57:24 +0900 Subject: [PATCH] rt: rename `shared` to `sharded` in internal ShardedList (#8364) --- tokio/src/runtime/task/list.rs | 14 +++++++------- tokio/src/util/sharded_list.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tokio/src/runtime/task/list.rs b/tokio/src/runtime/task/list.rs index 6eb8ec800..3a26c94f0 100644 --- a/tokio/src/runtime/task/list.rs +++ b/tokio/src/runtime/task/list.rs @@ -74,9 +74,9 @@ struct OwnedTasksInner { impl OwnedTasks { pub(crate) fn new(num_cores: usize) -> Self { - let shard_size = Self::gen_shared_list_size(num_cores); + let sharded_size = Self::gen_sharded_list_size(num_cores); Self { - list: ShardedList::new(shard_size), + list: ShardedList::new(sharded_size), closed: AtomicBool::new(false), id: get_next_id(), } @@ -224,11 +224,11 @@ impl OwnedTasks { /// nodes in the intrusive linked list will diminish. Furthermore, /// the construction time of the sharded list will also increase with a higher number of shards. /// - /// Due to the above reasons, we set a maximum value for the shared list size, - /// denoted as `MAX_SHARED_LIST_SIZE`. - fn gen_shared_list_size(num_cores: usize) -> usize { - const MAX_SHARED_LIST_SIZE: usize = 1 << 16; - usize::min(MAX_SHARED_LIST_SIZE, num_cores.next_power_of_two() * 4) + /// Due to the above reasons, we set a maximum value for the sharded list size, + /// denoted as `MAX_SHARDED_LIST_SIZE`. + fn gen_sharded_list_size(num_cores: usize) -> usize { + const MAX_SHARDED_LIST_SIZE: usize = 1 << 16; + usize::min(MAX_SHARDED_LIST_SIZE, num_cores.next_power_of_two() * 4) } } diff --git a/tokio/src/util/sharded_list.rs b/tokio/src/util/sharded_list.rs index 9249ffede..1c9bf564c 100644 --- a/tokio/src/util/sharded_list.rs +++ b/tokio/src/util/sharded_list.rs @@ -116,7 +116,7 @@ impl ShardedList { self.len() == 0 } - /// Gets the shard size of this `SharedList`. + /// Gets the shard size of this `ShardedList`. /// /// Used to help us to decide the parameter `shard_id` of the `pop_back` method. pub(crate) fn shard_size(&self) -> usize {