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

io: clarify clear_ready and clear_ready_matching documentation #6304

Merged
merged 5 commits into from Jan 27, 2024

Conversation

maminrayej
Copy link
Member

Resolves #6302.

@maminrayej maminrayej added T-docs Topic: documentation A-tokio Area: The main tokio crate M-io Module: tokio/io labels Jan 24, 2024
tokio/src/io/async_fd.rs Outdated Show resolved Hide resolved
Comment on lines 830 to 831
/// Note that that if a readiness notification occurs following the last operation
/// but prior to invoking `clear_ready`, it will not be cleared.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's really important to be very clear in the wording here, because the point we are making is tricky to understand.

Here's one suggested wording. This one tries to explain it twice with "in other words". I still don't love it though.

Suggested change
/// Note that that if a readiness notification occurs following the last operation
/// but prior to invoking `clear_ready`, it will not be cleared.
/// This method only clears readiness events that happened before the creation of this guard. In other words, if the IO resource becomes ready between the creation of the guard and this call to `clear_ready`, then the readiness is not actually cleared.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually like that the timing is tied to the creation of the guard. I believe it makes it clear.

Comment on lines 842 to 844
/// This implies that if a readiness notification occurs following the last operation
/// but prior to invoking `clear_ready`, it will not be cleared.
///
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part isn't on all of them? But I think the other change is probably sufficient.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes it was a leftover comment. Thanks.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn enabled auto-merge (squash) January 27, 2024 19:36
@Darksonn Darksonn merged commit e53b92a into tokio-rs:master Jan 27, 2024
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-io Module: tokio/io T-docs Topic: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation of AsyncFdReady*Guard::clear_ready is misleading
2 participants