Skip to content

Commit 1a77367

Browse files
Boqin QinDarksonn
authored andcommitted
io: add doc warning about concurrently calling poll_read/write_ready (tokio-rs#2439)
Co-authored-by: Alice Ryhl <[email protected]> Fixes: tokio-rs#2429
1 parent 3c7187b commit 1a77367

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tokio/src/io/poll_evented.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ where
261261
///
262262
/// * `ready` includes writable.
263263
/// * called from outside of a task context.
264+
///
265+
/// # Warning
266+
///
267+
/// This method may not be called concurrently. It takes `&self` to allow
268+
/// calling it concurrently with `poll_write_ready`.
264269
pub fn poll_read_ready(
265270
&self,
266271
cx: &mut Context<'_>,
@@ -327,6 +332,11 @@ where
327332
///
328333
/// * `ready` contains bits besides `writable` and `hup`.
329334
/// * called from outside of a task context.
335+
///
336+
/// # Warning
337+
///
338+
/// This method may not be called concurrently. It takes `&self` to allow
339+
/// calling it concurrently with `poll_read_ready`.
330340
pub fn poll_write_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<mio::Ready>> {
331341
poll_ready!(
332342
self,

0 commit comments

Comments
 (0)