Skip to content

Commit

Permalink
io: add doc warning about concurrently calling poll_read/write_ready (#…
Browse files Browse the repository at this point in the history
…2439)

Co-authored-by: Alice Ryhl <alice@ryhl.io>
Fixes: #2429
  • Loading branch information
Boqin Qin and Darksonn committed May 11, 2020
1 parent 6aeeeff commit 3ba818a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tokio/src/io/poll_evented.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ where
///
/// * `ready` includes writable.
/// * called from outside of a task context.
///
/// # Warning
///
/// This method may not be called concurrently. It takes `&self` to allow
/// calling it concurrently with `poll_write_ready`.
pub fn poll_read_ready(
&self,
cx: &mut Context<'_>,
Expand Down Expand Up @@ -327,6 +332,11 @@ where
///
/// * `ready` contains bits besides `writable` and `hup`.
/// * called from outside of a task context.
///
/// # Warning
///
/// This method may not be called concurrently. It takes `&self` to allow
/// calling it concurrently with `poll_read_ready`.
pub fn poll_write_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<mio::Ready>> {
poll_ready!(
self,
Expand Down

0 comments on commit 3ba818a

Please sign in to comment.