Skip to content
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

avoid unnecessary poll source.ready().await when events happen immediately #62

Open
cssivision opened this issue May 9, 2021 · 0 comments

Comments

@cssivision
Copy link
Contributor

cssivision commented May 9, 2021

ticks indicate whether event have happened, after record ticks we register event to reactor and return Pending. if event happen immediately, tick will be:

let tick = self
            .reactor
            .ticker
            .fetch_add(1, Ordering::SeqCst)
            .wrapping_add(1);

because reactor block on wait, which will cause ticks.0 equal to tick when we wake this task. and we reregister event to reactor and wake again. this time ticks.0 increase 1, and we return Poll::Ready now.

IMO ticks.0 is useless maybe we can just use ticks.1 to indicate whether event has happened. or we can set state[dir].tick = tick + 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant