Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try_join_next for JoinSet #6277

Closed
jhelwig opened this issue Jan 8, 2024 · 1 comment · Fixed by #6280
Closed

try_join_next for JoinSet #6277

jhelwig opened this issue Jan 8, 2024 · 1 comment · Fixed by #6280
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-task Module: tokio/task

Comments

@jhelwig
Copy link

jhelwig commented Jan 8, 2024

As pointed out in the discussion in #6157, JoinSet appears to be missing a method equivalent to try_recv on mpsc::Channel. There is poll_join_next, but this appears to be intended for when manually implementing the Future trait, as it requires access to a Context.

It is possible to maintain a set of JoinHandle, and periodically check is_finished on each, where there might be more JoinHandle added to the set that is being tracked between checks. However, it feels like JoinSet is also intended for this use case, and would be a much more ergonomic abstraction over having to manually do this bookkeeping.

@jhelwig jhelwig added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Jan 8, 2024
@Darksonn Darksonn added the M-task Module: tokio/task label Jan 8, 2024
@Darksonn
Copy link
Contributor

Darksonn commented Jan 8, 2024

We can add try_join_next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-task Module: tokio/task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants