-
Notifications
You must be signed in to change notification settings - Fork 230
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
How to implement a Yield #322
Comments
+1 to this request to add
|
Version
0.2.4
Platform
Linux seoul-microk8s 5.15.0-125-generic
Description
I need to do a customized polling
How could I implement a yield in monoio? If I follow the standard way (e.g. like futures_lite)
Because it notify the waker, it will be inserted into the front of the task queue instead of the back of the task queue, which means other tasks will be starved (and then because nobody submit a task it will just poll forever instead of doing anything valuable).
monoio/monoio/src/scheduler.rs
Lines 12 to 14 in 704e7d5
The same version works in
tokio
, which can either due to their scheduling policy or the cooperative yielding.In
tokio
special version ofyield_now
, they includes acontext::defer(cx.waker());
, which probably prevent the needs for using the cooperative yielding.The text was updated successfully, but these errors were encountered: