Skip to content

Commit ad6f9ea

Browse files
committed
runtime: remove duplicated method Steal<T>::len()
1 parent 65f009d commit ad6f9ea

File tree

1 file changed

+4
-9
lines changed
  • tokio/src/runtime/scheduler/multi_thread

1 file changed

+4
-9
lines changed

tokio/src/runtime/scheduler/multi_thread/queue.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,15 @@ impl<T> Local<T> {
391391
}
392392

393393
impl<T> Steal<T> {
394-
fn len(&self) -> usize {
394+
/// Returns the number of entries in the queue
395+
pub(crate) fn len(&self) -> usize {
395396
let (_, head) = unpack(self.0.head.load(Acquire));
396397
let tail = self.0.tail.load(Acquire);
397398
len(head, tail)
398399
}
399400

401+
/// Return true if the queue is empty,
402+
/// false if there are any entries in the queue
400403
pub(crate) fn is_empty(&self) -> bool {
401404
self.len() == 0
402405
}
@@ -556,14 +559,6 @@ impl<T> Steal<T> {
556559
}
557560
}
558561

559-
cfg_unstable_metrics! {
560-
impl<T> Steal<T> {
561-
pub(crate) fn len(&self) -> usize {
562-
self.0.len() as _
563-
}
564-
}
565-
}
566-
567562
impl<T> Clone for Steal<T> {
568563
fn clone(&self) -> Steal<T> {
569564
Steal(self.0.clone())

0 commit comments

Comments
 (0)