-
Notifications
You must be signed in to change notification settings - Fork 620
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
Async WaitGroup #2880
Comments
This wakes up the last registered Waker, but isn't that insufficient for the purpose of WaitGroup? (I think it should wake up all waiters.)
|
@taiki-e Thanks for your feedback! So in general this direction and the For the wake up all implementation, I can take a closer look and we can discuss on implementation with a PR. |
This is a moved issue from rust-lang/libs-team#427 (comment).
Proposal
Problem statement
crossbeam provides a WaitGroup that is good for synchronizing a fork-join task.
However, it's a sync version, meaning that it's not suitable to use in
async
/await
context.I made a tidy and solid async
WaitGroup
implementation and wonder if it's suitable to contribute to the std lib (e.g.,std::sync
) orfutures-util
or anywhere that is (de-facto) standard so that the ecosystem can collaborate together instead of make one own each time.Motivating examples or use cases
My motivating scenario is during the server starting, wait for all its components ready. For example,
Solution sketch
The implementation is tidy, and can be even inlined here:
Alternatives
The main argument is whether it should be in the std lib, or anywhere suitable for the most Rust developers to collaborate on.
Links and related work
This is somehow derivative from waitgroup-rs.
The text was updated successfully, but these errors were encountered: