-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
[FEATURE REQUEST] Add yield_now future or equivelant #1215
Comments
Some thoughts:
@alatiera Do you want to make a PR for this? |
Thanks for the comment and the implementation details!
given that the other executors have their own versions, I think this would be fine
Yea I'd like to give a go at some point, but not high priority for now. |
Somewhat unrelated, and more like a clarification:
Isn't here |
Yes, bad example code and wasn't even needed anyway. Removed it from the example |
Both tokio and async-std have a
yield_now
future, which is a manual hand-off back to executor to allow to schedule other things. Similar toG_SOURCE_CONTINUE
/glib::ControlFlow::Continue
.https://docs.rs/async-std/1.12.0/async_std/task/fn.yield_now.html
https://docs.rs/tokio/1.33.0/tokio/task/fn.yield_now.html
An example is when you are manually looping over sync code you can await after a long running task.
For another example see:
Example code for a yield future, though should ideally be ported to
impl Future
cc @sdroege
The text was updated successfully, but these errors were encountered: