-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
when_all method #1153
Comments
Thanks for the suggestion! I've been putting this off mostly because it's very easy to do it without a dedicated library feature: dpp::task<void> tasks[4];
for (auto& task : tasks) {
task = bot.co_do_something();
}
for (auto& task : tasks) {
co_await task;
} Though maybe a |
Tbh I would take a I do wonder if there's any specific case to needing it to be randomly fired. |
Could jobs be launched in parallel perhaps? I'm not sure if |
This happens to begin with with dpp::task and dpp::async |
This issue has had no activity and is being marked as stale. If you still wish to continue with this issue please comment to reopen it. |
Bump |
Is your feature request related to a problem? Please describe.
No problems, just inspiration from the implemented
when_any
with coroutines.Describe the solution you'd like
Stated above, it would be nice to have a
when_all
(analogous to aPromise.allSettled
from JS) method that works very similarly towhen_any
, except on the return condition. So all coroutines in the proposedwhen_all
call would have to be fulfilled before resuming execution. In other words, it would resume when all coroutines complete.Describe alternatives you've considered
Instead of alternatives, I'll give a use case. Say you want to send a DM to multiple users and want to wait until all of them have responded/interacted/etc. with the message. You could use this
when_all
to do this very easily.Additional context
This may already be a feature idk, but if not, it would be a logical pairing with
when_any
.The text was updated successfully, but these errors were encountered: