id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use futures::future::{pending, FutureExt}; use std::panic; use tokio::sync::oneshot; use tokio::task::{JoinSet, LocalSet}; use tokio::time::Duration; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .un...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
pending::<()>().await; drop(tx); }; match on { None => set.spawn_local(fut), Some(local) => set.spawn_local_on(fut, local), }; } } // Await every task in a JoinSet and assert every task returns its own index. async fn drain_joinset_and_assert(mut set: Jo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:3
} set.detach_all(); assert_eq!(set.len(), 0); assert!(set.join_next().await.is_none()); for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); assert_eq!(set.len(), 1 + i); } let mut seen = [false;...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
assert!(set.join_next().await.is_none()); } #[tokio::test] async fn test_abort_on_drop() { let mut set = JoinSet::new(); let mut recvs = Vec::new(); for _ in 0..16 { let (send, recv) = oneshot::channel::<()>(); recvs.push(recv); set.spawn(async { // This task will nev...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
assert_eq!(set.len(), 1); set.spawn(async {}); assert_eq!(set.len(), 2); } } #[tokio::test(start_paused = true)] async fn abort_tasks() { let mut set = JoinSet::new(); let mut num_canceled = 0; let mut num_completed = 0; for i in 0..16 { let abort = set.spawn(async move { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
#[test] fn runtime_gone() { let mut set = JoinSet::new(); { let rt = rt(); set.spawn_on(async { 1 }, rt.handle()); drop(rt); } assert!(rt() .block_on(set.join_next()) .unwrap() .unwrap_err() .is_cancelled()); } #[tokio::test] async fn join_all() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_join_set.rs:7
tokio::time::sleep(Duration::from_secs(2)).await; tx.send(()).unwrap(); }); assert_eq!(set.len(), 1); set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; panic!(); }); assert_eq!(set.len(), 2); let panic = tokio::spawn(set.join_all()).await.unwrap_err();...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_join_set.rs:8
count += 1; } assert_eq!(count, 10); assert_eq!(set.len(), 0); } // This ensures that `join_next` works correctly when the coop budget is // exhausted. #[tokio::test(flavor = "current_thread")] async fn join_set_coop() { // Large enough to trigger coop. const TASK_NUM: u32 = 1000; static SEM: ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_join_set.rs:9
Some(None) => break, } count += 1; } assert!(coop_count >= 1); assert_eq!(count, TASK_NUM); } #[tokio::test(flavor = "current_thread")] async fn try_join_next() { const TASK_NUM: u32 = 1000; let (send, recv) = tokio::sync::watch::channel(()); let mut set = JoinSet::new(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
321
380
tokio-rs/tokio:tokio/tests/task_join_set.rs:10
assert_eq!(count, TASK_NUM); } #[cfg(tokio_unstable)] #[tokio::test(flavor = "current_thread")] async fn try_join_next_with_id() { const TASK_NUM: u32 = 1000; let (send, recv) = tokio::sync::watch::channel(()); let mut set = JoinSet::new(); let mut spawned = std::collections::HashSet::with_capacity(T...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_join_set.rs:11
} assert_eq!(count, TASK_NUM); assert_eq!(joined, spawned); } #[tokio::test] async fn extend() { let mut set: JoinSet<_> = (0..5).map(|i| async move { i }).collect(); set.extend((5..10).map(|i| async move { i })); let mut seen = [false; 10]; while let Some(res) = set.join_next().await { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
401
460
tokio-rs/tokio:tokio/tests/task_join_set.rs:12
let mut set = JoinSet::new(); set.spawn_local(async {}); } #[cfg(tokio_unstable)] mod local_runtime { use super::*; /// Spawn several tasks, and then join all tasks. #[tokio::test(flavor = "local")] async fn spawn_then_join_next() { const N: usize = 8; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
441
500
tokio-rs/tokio:tokio/tests/task_join_set.rs:13
const N: usize = 8; let mut set = JoinSet::new(); let mut receivers = Vec::new(); spawn_pending_tasks(&mut set, &mut receivers, N, None); assert!(set.try_join_next().is_none()); drop(set); await_receivers_and_assert(receivers).await; } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
481
540
tokio-rs/tokio:tokio/tests/task_join_set.rs:14
let mut receivers = Vec::new(); spawn_pending_tasks(&mut set, &mut receivers, N, None); assert!(set.try_join_next().is_none()); set.shutdown().await; assert!(set.is_empty()); await_receivers_and_assert(receivers).awai...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
521
580
tokio-rs/tokio:tokio/tests/task_join_set.rs:15
use super::*; /// Spawn several tasks, and then join all tasks. #[tokio::test(flavor = "local")] async fn spawn_then_join_next() { const N: usize = 8; let local = LocalSet::new(); let mut set = JoinSet::new(); spawn_index_tasks(&mut set, N, Some...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
561
620
tokio-rs/tokio:tokio/tests/task_join_set.rs:16
/// Spawn several pending-forever tasks, and then shutdown the [`JoinSet`]. #[tokio::test(flavor = "current_thread")] async fn spawn_then_shutdown() { const N: usize = 8; let local = LocalSet::new(); let mut set = JoinSet::new(); let mut receivers = Vec::n...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
601
660
tokio-rs/tokio:tokio/tests/task_join_set.rs:17
}) .await; } { let local = LocalSet::new(); let mut set = JoinSet::new(); let mut receivers = Vec::new(); spawn_pending_tasks(&mut set, &mut receivers, N, Some(&local)); assert!(set.try_join_nex...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_join_set.rs
641
662
tokio-rs/tokio:tokio/tests/task_join_set.rs:10
assert_eq!(count, TASK_NUM); } #[cfg(tokio_unstable)] #[tokio::test(flavor = "current_thread")] async fn try_join_next_with_id() { const TASK_NUM: u32 = 1000; let (send, recv) = tokio::sync::watch::channel(()); let mut set = JoinSet::new(); let mut spawned = std::collections::HashSet::with_capacity(T...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
b8318fa1723784cc7f777a900af74ada0ad0dbf7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8318fa1723784cc7f777a900af74ada0ad0dbf7/tokio/tests/task_join_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_join_set.rs:11
} assert_eq!(count, TASK_NUM); assert_eq!(joined, spawned); } mod spawn_local { use super::*; #[test] #[should_panic( expected = "`spawn_local` called from outside of a `task::LocalSet` or `runtime::LocalRuntime`" )] fn panic_outside_any_runtime() { let mut set = JoinSet::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
b8318fa1723784cc7f777a900af74ada0ad0dbf7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8318fa1723784cc7f777a900af74ada0ad0dbf7/tokio/tests/task_join_set.rs
401
460
tokio-rs/tokio:tokio/tests/task_join_set.rs:12
drain_joinset_and_assert(set, N).await; } /// Spawn several pending-forever tasks, and then shutdown the [`JoinSet`]. #[tokio::test(flavor = "local")] async fn spawn_then_shutdown() { const N: usize = 8; let mut set = JoinSet::new(); let mut receiver...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
b8318fa1723784cc7f777a900af74ada0ad0dbf7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8318fa1723784cc7f777a900af74ada0ad0dbf7/tokio/tests/task_join_set.rs
441
500
tokio-rs/tokio:tokio/tests/task_join_set.rs:13
#[tokio::test(flavor = "current_thread")] async fn spawn_then_join_next() { const N: usize = 8; let local = LocalSet::new(); local .run_until(async move { let mut set = JoinSet::new(); spawn_index_tasks(&mut set, N, Non...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
b8318fa1723784cc7f777a900af74ada0ad0dbf7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8318fa1723784cc7f777a900af74ada0ad0dbf7/tokio/tests/task_join_set.rs
481
540
tokio-rs/tokio:tokio/tests/task_join_set.rs:14
let local = LocalSet::new(); local .run_until(async { let mut set = JoinSet::new(); let mut receivers = Vec::new(); spawn_pending_tasks(&mut set, &mut receivers, N, None); assert!(set.try_join_next().is_none())...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
b8318fa1723784cc7f777a900af74ada0ad0dbf7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8318fa1723784cc7f777a900af74ada0ad0dbf7/tokio/tests/task_join_set.rs
521
580
tokio-rs/tokio:tokio/tests/task_join_set.rs:15
.await; } } mod local_set { use super::*; /// Spawn several tasks, and then join all tasks. #[tokio::test(flavor = "current_thread")] async fn spawn_then_join_next() { const N: usize = 8; let local = LocalSet::new(); let mut pending_s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
b8318fa1723784cc7f777a900af74ada0ad0dbf7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8318fa1723784cc7f777a900af74ada0ad0dbf7/tokio/tests/task_join_set.rs
561
620
tokio-rs/tokio:tokio/tests/task_join_set.rs:16
}) .await; } /// Spawn several pending-forever tasks and then drop the [`JoinSet`] /// before the `LocalSet` is driven and while the `LocalSet` is already driven. #[tokio::test(flavor = "current_thread")] async fn spawn_then_drop() { const N: usize = ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
b8318fa1723784cc7f777a900af74ada0ad0dbf7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8318fa1723784cc7f777a900af74ada0ad0dbf7/tokio/tests/task_join_set.rs
601
645
tokio-rs/tokio:tokio/tests/task_join_set.rs:10
assert_eq!(count, TASK_NUM); } #[cfg(tokio_unstable)] #[tokio::test(flavor = "current_thread")] async fn try_join_next_with_id() { const TASK_NUM: u32 = 1000; let (send, recv) = tokio::sync::watch::channel(()); let mut set = JoinSet::new(); let mut spawned = std::collections::HashSet::with_capacity(T...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987/tokio/tests/task_join_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_join_set.rs:11
} assert_eq!(count, TASK_NUM); assert_eq!(joined, spawned); } mod spawn_local { use super::*; #[cfg(tokio_unstable)] mod local_runtime { use super::*; /// Spawn several tasks, and then join all tasks. #[tokio::test(flavor = "local")] async fn spawn_then_join_next(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987/tokio/tests/task_join_set.rs
401
460
tokio-rs/tokio:tokio/tests/task_join_set.rs:12
} /// Spawn several pending-forever tasks, and then drop the [`JoinSet`]. #[tokio::test(flavor = "local")] async fn spawn_then_drop() { const N: usize = 8; let mut set = JoinSet::new(); let mut receivers = Vec::new(); spawn_pending_tasks(&mut set...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987/tokio/tests/task_join_set.rs
441
500
tokio-rs/tokio:tokio/tests/task_join_set.rs:13
let local = LocalSet::new(); local .run_until(async { let mut set = JoinSet::new(); let mut receivers = Vec::new(); spawn_pending_tasks(&mut set, &mut receivers, N, None); assert!(set.try_join_next().is_none())...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987/tokio/tests/task_join_set.rs
481
540
tokio-rs/tokio:tokio/tests/task_join_set.rs:14
mod spawn_local_on { use super::*; #[cfg(tokio_unstable)] mod local_runtime { use super::*; /// Spawn several tasks, and then join all tasks. #[tokio::test(flavor = "local")] async fn spawn_then_join_next() { const N: usize = 8; let local = LocalSet...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987/tokio/tests/task_join_set.rs
521
580
tokio-rs/tokio:tokio/tests/task_join_set.rs:15
.run_until(async move { drain_joinset_and_assert(pending_set, N).await; }) .await; } /// Spawn several pending-forever tasks, and then shutdown the [`JoinSet`]. #[tokio::test(flavor = "current_thread")] async fn spawn_then_shutdown() {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987/tokio/tests/task_join_set.rs
561
620
tokio-rs/tokio:tokio/tests/task_join_set.rs:16
drop(set); local .run_until(async move { await_receivers_and_assert(receivers).await; }) .await; } { let local = LocalSet::new(); let mut set = JoinSet::new(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5dacc2e2a8ca151d0e4c5d7021bac8f1fdca1987/tokio/tests/task_join_set.rs
601
627
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use futures::future::FutureExt; use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio::test(start_paused = ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
for was_seen in &seen { assert!(was_seen); } assert!(set.join_next().await.is_none()); // Do it again. for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); } let mut seen = [false; 10]; while ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:3
drop(set); for recv in recvs { // The task is aborted soon and we will receive an error. assert!(recv.await.is_err()); } } #[tokio::test] async fn alternating() { let mut set = JoinSet::new(); assert_eq!(set.len(), 0); set.spawn(async {}); assert_eq!(set.len(), 1); set.spa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
abort.abort(); } } loop { match set.join_next().await { Some(Ok(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Some(Err(e)) => { assert!(e.is_cancelled()); num_canceled += 1; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
for _ in 0..5 { set.spawn(async { 1 }); } let res: Vec<i32> = set.join_all().await; assert_eq!(res.len(), 5); for itm in res.into_iter() { assert_eq!(itm, 1) } } #[cfg(panic = "unwind")] #[tokio::test(start_paused = true)] async fn task_panics() { let mut set: JoinSet<()> = Joi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The join set will now have 5 pending tasks and 5 ready tasks. tokio::time::sleep(Duration::from_secs(2)).await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_join_set.rs:7
SEM.add_permits(1); }); } // Wait for all tasks to complete. // // Since this is a `current_thread` runtime, there's no race condition // between the last permit being added and the task completing. let _ = SEM.acquire_many(TASK_NUM).await.unwrap(); let mut count = 0; let mut c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_join_set.rs:8
set.spawn(async move { recv.changed().await.unwrap() }); } drop(recv); assert!(set.try_join_next().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; loop { match set.try_join_next() { Some(Ok(())) => { count += 1; } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_join_set.rs:9
} drop(recv); assert!(set.try_join_next_with_id().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; let mut joined = std::collections::HashSet::with_capacity(TASK_NUM as usize); loop { match set.try_join_next_with_id() { Some(Ok((id, ()))) => {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_join_set.rs
321
346
tokio-rs/tokio:tokio/tests/task_join_set.rs:8
set.spawn(async move { recv.changed().await.unwrap() }); } drop(recv); assert!(set.try_join_next().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; loop { match set.try_join_next() { Some(Ok(())) => { count += 1; } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/task_join_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_join_set.rs:9
} drop(recv); assert!(set.try_join_next_with_id().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; let mut joined = std::collections::HashSet::with_capacity(TASK_NUM as usize); loop { match set.try_join_next_with_id() { Some(Ok((id, ()))) => {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/task_join_set.rs
321
346
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use futures::future::FutureExt; use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
for was_seen in &seen { assert!(was_seen); } assert!(set.join_next().await.is_none()); // Do it again. for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); } let mut seen = [false; 10]; while ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:3
} drop(set); for recv in recvs { // The task is aborted soon and we will receive an error. assert!(recv.await.is_err()); } } #[tokio::test] async fn alternating() { let mut set = JoinSet::new(); assert_eq!(set.len(), 0); set.spawn(async {}); assert_eq!(set.len(), 1); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
// abort odd-numbered tasks. abort.abort(); } } loop { match set.join_next().await { Some(Ok(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Some(Err(e)) => { assert!(e.is_cancelled()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
let mut set: JoinSet<i32> = JoinSet::new(); for _ in 0..5 { set.spawn(async { 1 }); } let res: Vec<i32> = set.join_all().await; assert_eq!(res.len(), 5); for itm in res.into_iter() { assert_eq!(itm, 1) } } #[cfg(panic = "unwind")] #[tokio::test(start_paused = true)] async fn t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
let mut set: JoinSet<()> = JoinSet::new(); for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The join set will now have 5 pending tasks and 5 ready tasks. tok...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_join_set.rs:7
set.spawn(async { SEM.add_permits(1); }); } // Wait for all tasks to complete. // // Since this is a `current_thread` runtime, there's no race condition // between the last permit being added and the task completing. let _ = SEM.acquire_many(TASK_NUM).await.unwrap(); le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_join_set.rs:8
let mut recv = recv.clone(); set.spawn(async move { recv.changed().await.unwrap() }); } drop(recv); assert!(set.try_join_next().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; loop { match set.try_join_next() { Some(Ok(())) => { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_join_set.rs:9
spawned.insert(handle.id()); } drop(recv); assert!(set.try_join_next_with_id().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; let mut joined = std::collections::HashSet::with_capacity(TASK_NUM as usize); loop { match set.try_join_next_with_id() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
d4178cf34924d14fca4ecf551c97b8953376f25a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/task_join_set.rs
321
347
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
let mut set: JoinSet<()> = JoinSet::new(); for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The join set will now have 5 pending tasks and 5 ready tasks. tok...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
cc70a211ad4ce71388c99e8af7480f3ddddbf602
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc70a211ad4ce71388c99e8af7480f3ddddbf602/tokio/tests/task_join_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_join_set.rs:7
set.spawn(async { SEM.add_permits(1); }); } // Wait for all tasks to complete. // // Since this is a `current_thread` runtime, there's no race condition // between the last permit being added and the task completing. let _ = SEM.acquire_many(TASK_NUM).await.unwrap(); le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
cc70a211ad4ce71388c99e8af7480f3ddddbf602
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc70a211ad4ce71388c99e8af7480f3ddddbf602/tokio/tests/task_join_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_join_set.rs:8
let mut recv = recv.clone(); set.spawn(async move { recv.changed().await.unwrap() }); } drop(recv); assert!(set.try_join_next().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; loop { match set.try_join_next() { Some(Ok(())) => { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
cc70a211ad4ce71388c99e8af7480f3ddddbf602
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc70a211ad4ce71388c99e8af7480f3ddddbf602/tokio/tests/task_join_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
// abort odd-numbered tasks. abort.abort(); } } loop { match set.join_next().await { Some(Ok(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Some(Err(e)) => { assert!(e.is_cancelled()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
2a0df5fb05ae1a624fe2f6db756190f41812214b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
abort.abort(); } } loop { match set.join_next().await { Some(Ok(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Some(Err(e)) => { assert!(e.is_cancelled()); num_canceled += 1; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
12ce924fb9c1ffe0340b979fefa00d13ebf631c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12ce924fb9c1ffe0340b979fefa00d13ebf631c3/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The join set will now have 5 pending tasks and 5 ready tasks. tokio::time::sleep(Duration::from_secs(2)).await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
12ce924fb9c1ffe0340b979fefa00d13ebf631c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12ce924fb9c1ffe0340b979fefa00d13ebf631c3/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
SEM.add_permits(1); }); } // Wait for all tasks to complete. // // Since this is a `current_thread` runtime, there's no race condition // between the last permit being added and the task completing. let _ = SEM.acquire_many(TASK_NUM).await.unwrap(); let mut count = 0; let mut c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
12ce924fb9c1ffe0340b979fefa00d13ebf631c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12ce924fb9c1ffe0340b979fefa00d13ebf631c3/tokio/tests/task_join_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_join_set.rs:7
set.spawn(async move { recv.changed().await.unwrap() }); } drop(recv); assert!(set.try_join_next().is_none()); send.send_replace(()); send.closed().await; let mut count = 0; loop { match set.try_join_next() { Some(Ok(())) => { count += 1; } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
12ce924fb9c1ffe0340b979fefa00d13ebf631c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12ce924fb9c1ffe0340b979fefa00d13ebf631c3/tokio/tests/task_join_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
SEM.add_permits(1); }); } // Wait for all tasks to complete. // // Since this is a `current_thread` runtime, there's no race condition // between the last permit being added and the task completing. let _ = SEM.acquire_many(TASK_NUM).await.unwrap(); let mut count = 0; let mut c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
84c5674c601dfc36ab417ff0ec01763c2dd30a5c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/task_join_set.rs
201
229
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use futures::future::FutureExt; use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio::test(start_paused = ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
for was_seen in &seen { assert!(was_seen); } assert!(matches!(set.join_next().await, None)); // Do it again. for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); } let mut seen = [false; 10]; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full"))] use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio::test(start_paused = true)] async fn test_with_s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
assert!(was_seen); } assert!(matches!(set.join_next().await, None)); // Do it again. for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); } let mut seen = [false; 10]; while let Some(res) = set.join_n...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
} } loop { match set.join_next().await { Some(Ok(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Some(Err(e)) => { assert!(e.is_cancelled()); num_canceled += 1; } None => ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The join set will now have 5 pending tasks and 5 ready tasks. tokio::time::sleep(Duration::from_secs(2)).await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
let mut set = JoinSet::new(); for _ in 0..TASK_NUM { set.spawn(async { SEM.add_permits(1); }); } // Wait for all tasks to complete. // // Since this is a `current_thread` runtime, there's no race condition // between the last perm...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/task_join_set.rs
201
235
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full"))] use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; use futures::future::FutureExt; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio::test(start_pau...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
ce5d2a466f6cbad6e5496bbb0df852c7429b8303
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce5d2a466f6cbad6e5496bbb0df852c7429b8303/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
for was_seen in &seen { assert!(was_seen); } assert!(matches!(set.join_next().await, None)); // Do it again. for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); } let mut seen = [false; 10]; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
ce5d2a466f6cbad6e5496bbb0df852c7429b8303
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce5d2a466f6cbad6e5496bbb0df852c7429b8303/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
// abort odd-numbered tasks. abort.abort(); } } loop { match set.join_next().await { Some(Ok(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Some(Err(e)) => { assert!(e.is_cancelled()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
ce5d2a466f6cbad6e5496bbb0df852c7429b8303
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce5d2a466f6cbad6e5496bbb0df852c7429b8303/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
#[tokio::test(flavor = "current_thread")] async fn join_set_coop() { // Large enough to trigger coop. const TASK_NUM: u32 = 1000; static SEM: tokio::sync::Semaphore = tokio::sync::Semaphore::const_new(0); let mut set = JoinSet::new(); for _ in 0..TASK_NUM { set.spawn(async { S...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
ce5d2a466f6cbad6e5496bbb0df852c7429b8303
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce5d2a466f6cbad6e5496bbb0df852c7429b8303/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
#[tokio::test(start_paused = true)] async fn abort_all() { let mut set: JoinSet<()> = JoinSet::new(); for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The jo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
ce5d2a466f6cbad6e5496bbb0df852c7429b8303
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce5d2a466f6cbad6e5496bbb0df852c7429b8303/tokio/tests/task_join_set.rs
201
230
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", tokio_unstable))] use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; use futures::future::FutureExt; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", tokio_unstable))] use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; use futures::future::FutureExt; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
for was_seen in &seen { assert!(was_seen); } assert!(matches!(set.join_one().await, None)); // Do it again. for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); } let mut seen = [false; 10]; w...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:3
} drop(set); for recv in recvs { // The task is aborted soon and we will receive an error. assert!(recv.await.is_err()); } } #[tokio::test] async fn alternating() { let mut set = JoinSet::new(); assert_eq!(set.len(), 0); set.spawn(async {}); assert_eq!(set.len(), 1); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/tests/task_join_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
// abort odd-numbered tasks. abort.abort(); } } loop { match set.join_one().await { Some(Ok(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Some(Err(e)) => { assert!(e.is_cancelled()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
#[tokio::test(flavor = "current_thread")] async fn join_set_coop() { // Large enough to trigger coop. const TASK_NUM: u32 = 1000; static SEM: tokio::sync::Semaphore = tokio::sync::Semaphore::const_new(0); let mut set = JoinSet::new(); for _ in 0..TASK_NUM { set.spawn(async { S...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
#[tokio::test(start_paused = true)] async fn abort_all() { let mut set: JoinSet<()> = JoinSet::new(); for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The jo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/tests/task_join_set.rs
201
230
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", tokio_unstable))] use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; use futures::future::FutureExt; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_join_set.rs:2
for was_seen in &seen { assert!(was_seen); } assert!(matches!(set.join_one().await, Ok(None))); // Do it again. for i in 0..10 { set.spawn(async move { tokio::time::sleep(Duration::from_secs(i as u64)).await; i }); } let mut seen = [false; 10]; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/tests/task_join_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_join_set.rs:3
} drop(set); for recv in recvs { // The task is aborted soon and we will receive an error. assert!(recv.await.is_err()); } } #[tokio::test] async fn alternating() { let mut set = JoinSet::new(); assert_eq!(set.len(), 0); set.spawn(async {}); assert_eq!(set.len(), 1); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/tests/task_join_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
// abort odd-numbered tasks. abort.abort(); } } loop { match set.join_one().await { Ok(Some(res)) => { num_completed += 1; assert_eq!(res % 2, 0); } Err(e) => { assert!(e.is_cancelled()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
static SEM: tokio::sync::Semaphore = tokio::sync::Semaphore::const_new(0); let mut set = JoinSet::new(); for _ in 0..TASK_NUM { set.spawn(async { SEM.add_permits(1); }); } // Wait for all tasks to complete. // // Since this is a `current_thread` runtime, there's no...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/tests/task_join_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_join_set.rs:6
for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; }); } // The join set will now have 5 pending tasks and 5 ready tasks. tokio::time::sleep(Duration::from_secs(2)).await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/tests/task_join_set.rs
201
226
tokio-rs/tokio:tokio/tests/task_join_set.rs:3
} drop(set); for recv in recvs { // The task is aborted soon and we will receive an error. assert!(recv.await.is_err()); } } #[tokio::test] async fn alternating() { let mut set = JoinSet::new(); assert_eq!(set.len(), 0); set.spawn(async {}); assert_eq!(set.len(), 1); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
37917b821d58f2ce3f7be109bf4d309d78bd8740
github
async-runtime
https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/tests/task_join_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_join_set.rs:4
// This ensures that `join_one` works correctly when the coop budget is // exhausted. #[tokio::test(flavor = "current_thread")] async fn join_set_coop() { // Large enough to trigger coop. const TASK_NUM: u32 = 1000; static SEM: tokio::sync::Semaphore = tokio::sync::Semaphore::const_new(0); let mut set...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
37917b821d58f2ce3f7be109bf4d309d78bd8740
github
async-runtime
https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/tests/task_join_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_join_set.rs:5
assert_eq!(count, TASK_NUM); } #[tokio::test(start_paused = true)] async fn abort_all() { let mut set: JoinSet<()> = JoinSet::new(); for _ in 0..5 { set.spawn(futures::future::pending()); } for _ in 0..5 { set.spawn(async { tokio::time::sleep(Duration::from_secs(1)).await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
37917b821d58f2ce3f7be109bf4d309d78bd8740
github
async-runtime
https://github.com/tokio-rs/tokio/blob/37917b821d58f2ce3f7be109bf4d309d78bd8740/tokio/tests/task_join_set.rs
161
192
tokio-rs/tokio:tokio/tests/task_join_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::oneshot; use tokio::task::JoinSet; use tokio::time::Duration; use futures::future::FutureExt; fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() } #[tokio::test(start_paused =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_join_set.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/tests/task_join_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_local.rs:1
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threads use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::sync::oneshot; #[tokio::test(flavor = "multi_thread")] async fn local() { tokio::task_local! { static REQ_ID: u32; pub stat...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_local.rs
1
60
tokio-rs/tokio:tokio/tests/task_local.rs:2
async fn task_local_available_on_abort() { tokio::task_local! { static KEY: u32; } struct MyFuture { tx_poll: Option<oneshot::Sender<()>>, tx_drop: Option<oneshot::Sender<u32>>, } impl Future for MyFuture { type Output = (); fn poll(mut self: Pin<&mut Self>,...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_local.rs
41
100
tokio-rs/tokio:tokio/tests/task_local.rs:3
let err = h.await.unwrap_err(); if !err.is_cancelled() { if let Ok(panic) = err.try_into_panic() { std::panic::resume_unwind(panic); } else { panic!(); } } } #[tokio::test] async fn task_local_available_on_completion_drop() { tokio::task_local! { stat...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_local.rs
81
140
tokio-rs/tokio:tokio/tests/task_local.rs:4
#[tokio::test] async fn take_value() { tokio::task_local! { static KEY: u32 } let fut = KEY.scope(1, async {}); let mut pinned = Box::pin(fut); assert_eq!(pinned.as_mut().take_value(), Some(1)); assert_eq!(pinned.as_mut().take_value(), None); } #[tokio::test] async fn poll_after_take_va...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_local.rs
121
171
tokio-rs/tokio:tokio/tests/task_local.rs:5
let fut = KEY.scope(1, async { let result = KEY.try_get(); // The task local value no longer exists. assert!(result.is_err()); }); let mut fut = Box::pin(fut); fut.as_mut().take_value(); // Poll the future after `take_value` has been called fut.await; }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_local.rs
161
171
tokio-rs/tokio:tokio/tests/task_local.rs:4
#[tokio::test] async fn take_value() { tokio::task_local! { static KEY: u32 } let fut = KEY.scope(1, async {}); let mut pinned = Box::pin(fut); assert_eq!(pinned.as_mut().take_value(), Some(1)); assert_eq!(pinned.as_mut().take_value(), None); } #[tokio::test] async fn poll_after_take_va...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
94db07b379092ac49527d98166dab43fc1197f27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/94db07b379092ac49527d98166dab43fc1197f27/tokio/tests/task_local.rs
121
147
tokio-rs/tokio:tokio/tests/task_local.rs:3
let err = h.await.unwrap_err(); if !err.is_cancelled() { if let Ok(panic) = err.try_into_panic() { std::panic::resume_unwind(panic); } else { panic!(); } } } #[tokio::test] async fn task_local_available_on_completion_drop() { tokio::task_local! { stat...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
84c5674c601dfc36ab417ff0ec01763c2dd30a5c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/task_local.rs
81
119
tokio-rs/tokio:tokio/tests/task_local.rs:1
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threads #![allow(clippy::declare_interior_mutable_const)] use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::sync::oneshot; #[tokio::test(flavor = "multi_thread")] async fn local() { tokio::task_loca...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_local.rs
1
60
tokio-rs/tokio:tokio/tests/task_local.rs:1
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threads #![allow(clippy::declare_interior_mutable_const)] use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::sync::oneshot; #[tokio::test(flavor = "multi_thread")] async fn local() { tokio::task_local! { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
fc9518b62714daac9a38b46c698b94ac5d5b1ca2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/task_local.rs
1
60
tokio-rs/tokio:tokio/tests/task_local.rs:1
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threads use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::sync::oneshot; #[tokio::test(flavor = "multi_thread")] async fn local() { tokio::task_local! { static REQ_ID: u32; pub static FOO: b...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/task_local.rs
1
60
tokio-rs/tokio:tokio/tests/task_local.rs:2
tokio::task_local! { static KEY: u32; } struct MyFuture { tx_poll: Option<oneshot::Sender<()>>, tx_drop: Option<oneshot::Sender<u32>>, } impl Future for MyFuture { type Output = (); fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()> { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/task_local.rs
41
100