io: add doc warning about concurrently calling poll_read/write_ready (#2439)

Co-authored-by: Alice Ryhl <alice@ryhl.io>
Fixes: #2429
This commit is contained in:
Boqin Qin 2020-05-12 03:59:46 +08:00 committed by GitHub
parent 6aeeeff6e8
commit 3ba818a177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<io::Result<mio::Ready>> {
poll_ready!(
self,