mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
task: fix flaky joinmap test during abort (#7509)
This commit is contained in:
parent
cf6b50a3fd
commit
f1d3b065b6
@ -69,8 +69,8 @@ use tokio::task::{AbortHandle, Id, JoinError, JoinSet, LocalSet};
|
||||
/// async fn main() {
|
||||
/// let mut map = JoinMap::new();
|
||||
///
|
||||
/// map.spawn("hello world", async move { /* ... */ });
|
||||
/// map.spawn("goodbye world", async move { /* ... */});
|
||||
/// map.spawn("hello world", std::future::ready(1));
|
||||
/// map.spawn("goodbye world", std::future::pending());
|
||||
///
|
||||
/// // Look up the "goodbye world" task in the map and abort it.
|
||||
/// let aborted = map.abort("goodbye world");
|
||||
@ -85,7 +85,7 @@ use tokio::task::{AbortHandle, Id, JoinError, JoinSet, LocalSet};
|
||||
/// assert!(res.unwrap_err().is_cancelled());
|
||||
/// } else {
|
||||
/// // Other tasks should complete normally.
|
||||
/// assert!(res.is_ok());
|
||||
/// assert_eq!(res.unwrap(), 1);
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
@ -495,12 +495,12 @@ where
|
||||
/// ```
|
||||
/// use tokio_util::task::JoinMap;
|
||||
///
|
||||
/// # #[tokio::main]
|
||||
/// # #[tokio::main(flavor = "current_thread")]
|
||||
/// # async fn main() {
|
||||
/// let mut map = JoinMap::new();
|
||||
///
|
||||
/// map.spawn("hello world", async move { /* ... */ });
|
||||
/// map.spawn("goodbye world", async move { /* ... */});
|
||||
/// map.spawn("hello world", std::future::ready(1));
|
||||
/// map.spawn("goodbye world", std::future::pending());
|
||||
///
|
||||
/// // Look up the "goodbye world" task in the map and abort it.
|
||||
/// map.abort("goodbye world");
|
||||
@ -511,7 +511,7 @@ where
|
||||
/// assert!(res.unwrap_err().is_cancelled());
|
||||
/// } else {
|
||||
/// // Other tasks should complete normally.
|
||||
/// assert!(res.is_ok());
|
||||
/// assert_eq!(res.unwrap(), 1);
|
||||
/// }
|
||||
/// }
|
||||
/// # }
|
||||
|
Loading…
x
Reference in New Issue
Block a user