From 3ba818a177a34dabd38c01a7a1aa15a5bc867c1f Mon Sep 17 00:00:00 2001 From: Boqin Qin Date: Tue, 12 May 2020 03:59:46 +0800 Subject: [PATCH] io: add doc warning about concurrently calling poll_read/write_ready (#2439) Co-authored-by: Alice Ryhl Fixes: #2429 --- tokio/src/io/poll_evented.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tokio/src/io/poll_evented.rs b/tokio/src/io/poll_evented.rs index 085a7e842da..f8be6f2f755 100644 --- a/tokio/src/io/poll_evented.rs +++ b/tokio/src/io/poll_evented.rs @@ -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<'_>, @@ -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> { poll_ready!( self,