Skip to content

Commit

Permalink
task: document behavior of JoinSet::try_join_next when all tasks ar…
Browse files Browse the repository at this point in the history
…e running (#6671)
  • Loading branch information
teor2345 committed Jul 2, 2024
1 parent fe7285d commit 4d0d89f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tokio/src/task/join_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl<T: 'static> JoinSet<T> {

/// Tries to join one of the tasks in the set that has completed and return its output.
///
/// Returns `None` if the set is empty.
/// Returns `None` if there are no completed tasks, or if the set is empty.
pub fn try_join_next(&mut self) -> Option<Result<T, JoinError>> {
// Loop over all notified `JoinHandle`s to find one that's ready, or until none are left.
loop {
Expand All @@ -331,7 +331,7 @@ impl<T: 'static> JoinSet<T> {
/// Tries to join one of the tasks in the set that has completed and return its output,
/// along with the [task ID] of the completed task.
///
/// Returns `None` if the set is empty.
/// Returns `None` if there are no completed tasks, or if the set is empty.
///
/// When this method returns an error, then the id of the task that failed can be accessed
/// using the [`JoinError::id`] method.
Expand Down

0 comments on commit 4d0d89f

Please sign in to comment.