-
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
Provide task::yield()
#177
Comments
Oh gah |
We should consider having the |
@ipetkov yeah it's also possible to do that, but we'd likely do that through something like |
@alexcrichton IMO I don't think this alias helps very much (well, except for avoiding the awkard looking As for using something like |
@ipetkov you could say the same about thread yielding "not providing a guarantee". A yield here would be equivalent here. The scheduler has the opportunity to schedule another task. Anything more advanced (back off on repeated yields, etc) can be handled by the scheduler providing its own API. Any such api can be built on top of the provided primitives. |
@carllerche Given the current primitives (and the proposition for yield), it's not clear to me how the same future could sometimes yield and sometimes unpark its task, yet allow the scheduler to react differently to each event. |
The scheduler could provide its own constructs. For example, imagine the CPU Pool lib could provide Keep in mind that the scheduler knows which task is currently being executed. |
That makes sense. Seems unfortunate to tightly couple a given future to a scheduler it may run on. Maybe it would be worth considering passing user specified tokens through |
This would be implemented something like:
Another option would be to provide a
yield!();
macro that includes the return.The text was updated successfully, but these errors were encountered: