-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -826,6 +826,9 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyGuard<'a, Inner> { | |
/// _actually observes_ that the file descriptor is _not_ ready. Do not call | ||
/// it simply because, for example, a read succeeded; it should be called | ||
/// when a read is observed to block. | ||
/// | ||
/// Note that that if a readiness notification occurs following the last operation | ||
/// but prior to invoking `clear_ready`, it will not be cleared. | ||
pub fn clear_ready(&mut self) { | ||
if let Some(event) = self.event.take() { | ||
self.async_fd.registration.clear_readiness(event); | ||
|
@@ -835,6 +838,8 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyGuard<'a, Inner> { | |
/// Indicates to tokio that the file descriptor no longer has a specific readiness. | ||
/// The internal readiness flag will be cleared, and tokio will wait for the | ||
/// next edge-triggered readiness notification from the OS. | ||
/// This implies that if a readiness notification occurs following the last operation | ||
/// but prior to invoking `clear_ready`, it will not be cleared. | ||
/// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes it was a leftover comment. Thanks. |
||
/// This function is useful in combination with the [`AsyncFd::ready`] method when a | ||
/// combined interest like `Interest::READABLE | Interest::WRITABLE` is used. | ||
|
@@ -846,6 +851,9 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyGuard<'a, Inner> { | |
/// block. For example when a read blocks when using a combined interest, | ||
/// only clear `Ready::READABLE`. | ||
/// | ||
/// Note that that if a readiness notification occurs following the last operation | ||
/// but prior to invoking `clear_ready`, it will not be cleared. | ||
/// | ||
/// # Examples | ||
/// | ||
/// Concurrently read and write to a [`std::net::TcpStream`] on the same task without | ||
|
@@ -1042,6 +1050,9 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyMutGuard<'a, Inner> { | |
/// _actually observes_ that the file descriptor is _not_ ready. Do not call | ||
/// it simply because, for example, a read succeeded; it should be called | ||
/// when a read is observed to block. | ||
/// | ||
/// Note that that if a readiness notification occurs following the last operation | ||
/// but prior to invoking `clear_ready`, it will not be cleared. | ||
pub fn clear_ready(&mut self) { | ||
if let Some(event) = self.event.take() { | ||
self.async_fd.registration.clear_readiness(event); | ||
|
@@ -1062,6 +1073,9 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyMutGuard<'a, Inner> { | |
/// block. For example when a read blocks when using a combined interest, | ||
/// only clear `Ready::READABLE`. | ||
/// | ||
/// Note that that if a readiness notification occurs following the last operation | ||
/// but prior to invoking `clear_ready`, it will not be cleared. | ||
/// | ||
/// # Examples | ||
/// | ||
/// Concurrently read and write to a [`std::net::TcpStream`] on the same task without | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.