mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
io: clarify clear_ready
docs (#6304)
This commit is contained in:
parent
7536132065
commit
e53b92a993
@ -826,6 +826,10 @@ 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.
|
||||
///
|
||||
/// 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.
|
||||
pub fn clear_ready(&mut self) {
|
||||
if let Some(event) = self.event.take() {
|
||||
self.async_fd.registration.clear_readiness(event);
|
||||
@ -846,6 +850,10 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyGuard<'a, Inner> {
|
||||
/// block. For example when a read blocks when using a combined interest,
|
||||
/// only clear `Ready::READABLE`.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Concurrently read and write to a [`std::net::TcpStream`] on the same task without
|
||||
@ -1042,6 +1050,10 @@ 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.
|
||||
///
|
||||
/// 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.
|
||||
pub fn clear_ready(&mut self) {
|
||||
if let Some(event) = self.event.take() {
|
||||
self.async_fd.registration.clear_readiness(event);
|
||||
@ -1062,6 +1074,10 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyMutGuard<'a, Inner> {
|
||||
/// block. For example when a read blocks when using a combined interest,
|
||||
/// only clear `Ready::READABLE`.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Concurrently read and write to a [`std::net::TcpStream`] on the same task without
|
||||
|
Loading…
x
Reference in New Issue
Block a user