Skip to content

Is there something like JoinSet, but will drop completed task automatically? #5910

Answered by Darksonn
lz1998 asked this question in Q&A
Discussion options

You must be logged in to vote

Note that it may help to wrap the calls in tokio::task::unconstrained.

pub fn clean(&mut self) {
    while let Some(Some(_)) = tokio::task::unconstrained(self.tasks.join_next()).now_or_never() {}
}

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Darksonn
Comment options

@lz1998
Comment options

@Darksonn
Comment options

@Darksonn
Comment options

Answer selected by lz1998
@lz1998
Comment options

@lz1998
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants