Skip to content

Commit

Permalink
7077 updated to use strong and weak count methods that already existe…
Browse files Browse the repository at this point in the history
…d, updated comments to match coding standards
  • Loading branch information
Ach B committed Jan 14, 2025
1 parent faa11d7 commit 4ede5b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions tokio/src/sync/mpsc/chan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ impl<T, S: Semaphore> Tx<T, S> {
}
notified.await;
}

pub(crate) fn len(&self) -> usize {
self.inner.tx_count.load(Ordering::SeqCst)
}
}

impl<T, S> Clone for Tx<T, S> {
Expand Down
5 changes: 3 additions & 2 deletions tokio/src/sync/mpsc/unbounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,10 @@ impl<T> UnboundedSender<T> {
self.chan.weak_count()
}

//Returns length of [`UnboundedSender`] semaphores /2, supposidly the number of messages.
///Returns length of [`UnboundedSender`] semaphores /2, the number of messages.
pub fn len(&self) -> usize{
self.chan.len()
(self.strong_count() + self.weak_count()) / 2

}
}

Expand Down

0 comments on commit 4ede5b9

Please sign in to comment.