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_local_set.rs:13
task::yield_now().await; }) .await; // Drop the LocalSet drop(local); } fn rt() -> Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/task_local_set.rs
481
494
tokio-rs/tokio:tokio/tests/task_local_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::{self, Runtime}; use tokio::sync::{mpsc, oneshot}; use tokio::task::{self, LocalSet}; use tokio::time; use std::cell::Cell; use std::sync::atomic::Ordering::{self, SeqCst}; use std::sync::atomic::{AtomicBool, AtomicUsize}; use std::time::Duratio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_local_set.rs:2
} #[tokio::test(threaded_scheduler)] async fn localset_future_threadpool() { thread_local! { static ON_LOCAL_THREAD: Cell<bool> = Cell::new(false); } ON_LOCAL_THREAD.with(|cell| cell.set(true)); let local = LocalSet::new(); local.spawn_local(async move { assert!(ON_LOCAL_THREAD.wi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_local_set.rs:3
static RAN3: AtomicBool = AtomicBool::new(false); let local = LocalSet::new(); local.spawn_local(async move { task::spawn_local(async { task::yield_now().await; RAN3.store(true, Ordering::SeqCst); }); task::yield_now().await; RAN1.store(true, Ordering::Se...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_local_set.rs:4
}) .await; } #[test] // This will panic, since the thread that calls `block_on` cannot use // in-place blocking inside of `block_on`. #[should_panic] fn local_threadpool_blocking_in_place() { thread_local! { static ON_RT_THREAD: Cell<bool> = Cell::new(false); } ON_RT_THREAD.with(|cell| cel...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_local_set.rs:5
.run_until(async { assert!(ON_RT_THREAD.with(|cell| cell.get())); let join = task::spawn_local(async move { assert!(ON_RT_THREAD.with(|cell| cell.get())); task::spawn_blocking(|| { assert!( !ON_RT_THREAD.with(|cell| cell...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_local_set.rs:6
} }) .await; } #[tokio::test(threaded_scheduler)] async fn nested_spawn_is_local() { thread_local! { static ON_RT_THREAD: Cell<bool> = Cell::new(false); } ON_RT_THREAD.with(|cell| cell.set(true)); LocalSet::new() .run_until(async { assert!(ON_RT_THREAD.with...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_local_set.rs:7
#[test] fn join_local_future_elsewhere() { thread_local! { static ON_RT_THREAD: Cell<bool> = Cell::new(false); } ON_RT_THREAD.with(|cell| cell.set(true)); let rt = runtime::Builder::new() .threaded_scheduler() .build() .unwrap(); let local = LocalSet::new(); loc...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_local_set.rs:8
}); } #[test] fn drop_cancels_tasks() { use std::rc::Rc; // This test reproduces issue #1842 let rt = rt(); let rc1 = Rc::new(()); let rc2 = rc1.clone(); let (started_tx, started_rx) = oneshot::channel(); let local = LocalSet::new(); local.spawn_local(async move { // Move thi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_local_set.rs:9
use std::sync::mpsc::RecvTimeoutError; let (done_tx, done_rx) = std::sync::mpsc::channel(); let thread = std::thread::spawn(move || { f(); // Send a message on the channel so that the test thread can // determine if we have entered an infinite loop: done_tx.send(()).unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
321
380
tokio-rs/tokio:tokio/tests/task_local_set.rs:10
// This test reproduces issue #1885. with_timeout(Duration::from_secs(60), || { let (tx, mut rx) = mpsc::channel::<()>(1024); let rt = rt(); let local = LocalSet::new(); local.spawn_local(async move { while rx.recv().await.is_some() {} }); local.block_on(&rt, async { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_local_set.rs:11
#[tokio::test] async fn local_tasks_are_polled_after_tick() { // Reproduces issues #1899 and #1900 static RX1: AtomicUsize = AtomicUsize::new(0); static RX2: AtomicUsize = AtomicUsize::new(0); static EXPECTED: usize = 500; let (tx, mut rx) = mpsc::unbounded_channel(); let local = LocalSet::ne...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
401
460
tokio-rs/tokio:tokio/tests/task_local_set.rs:12
}); while let Some(oneshot) = rx.recv().await { RX1.fetch_add(1, SeqCst); task::spawn_local(async move { oneshot.await.unwrap(); RX2.fetch_add(1, SeqCst); }); } task2.await.unwrap(); })...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
441
499
tokio-rs/tokio:tokio/tests/task_local_set.rs:13
// Tick the loop local .run_until(async { task::yield_now().await; }) .await; // Drop the LocalSet drop(local); } fn rt() -> Runtime { tokio::runtime::Builder::new() .basic_scheduler() .enable_all() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/task_local_set.rs
481
499
tokio-rs/tokio:tokio/tests/task_local_set.rs:2
} #[tokio::test(threaded_scheduler)] async fn localset_future_threadpool() { thread_local! { static ON_LOCAL_THREAD: Cell<bool> = Cell::new(false); } ON_LOCAL_THREAD.with(|cell| cell.set(true)); let local = LocalSet::new(); local.spawn_local(async move { assert!(ON_LOCAL_THREAD.wi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/task_local_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_local_set.rs:3
static RAN3: AtomicBool = AtomicBool::new(false); let local = LocalSet::new(); local.spawn_local(async move { task::spawn_local(async { task::yield_now().await; RAN3.store(true, Ordering::SeqCst); }); task::yield_now().await; RAN1.store(true, Ordering::Se...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/task_local_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_local_set.rs:8
}); } #[test] fn drop_cancels_tasks() { use std::rc::Rc; // This test reproduces issue #1842 let rt = rt(); let rc1 = Rc::new(()); let rc2 = rc1.clone(); let (started_tx, started_rx) = oneshot::channel(); let local = LocalSet::new(); local.spawn_local(async move { // Move thi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/task_local_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_local_set.rs:9
use std::sync::mpsc::RecvTimeoutError; let (done_tx, done_rx) = std::sync::mpsc::channel(); let thread = std::thread::spawn(move || { f(); // Send a message on the channel so that the test thread can // determine if we have entered an infinite loop: done_tx.send(()).unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/task_local_set.rs
321
380
tokio-rs/tokio:tokio/tests/task_local_set.rs:10
// This test reproduces issue #1885. with_timeout(Duration::from_secs(60), || { let (tx, mut rx) = mpsc::channel::<()>(1024); let rt = rt(); let local = LocalSet::new(); local.spawn_local(async move { while rx.recv().await.is_some() {} }); local.block_on(&rt, async { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/task_local_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_local_set.rs:11
#[tokio::test] async fn local_tasks_are_polled_after_tick() { // Reproduces issues #1899 and #1900 static RX1: AtomicUsize = AtomicUsize::new(0); static RX2: AtomicUsize = AtomicUsize::new(0); static EXPECTED: usize = 500; let (tx, mut rx) = mpsc::unbounded_channel(); let local = LocalSet::ne...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/task_local_set.rs
401
460
tokio-rs/tokio:tokio/tests/task_local_set.rs:3
static RAN3: AtomicBool = AtomicBool::new(false); let local = LocalSet::new(); local.spawn_local(async move { task::spawn_local(async { task::yield_now().await; RAN3.store(true, Ordering::SeqCst); }); task::yield_now().await; RAN1.store(true, Ordering::Se...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/task_local_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_local_set.rs:4
}) .await; } #[test] // This will panic, since the thread that calls `block_on` cannot use // in-place blocking inside of `block_on`. #[should_panic] fn local_threadpool_blocking_in_place() { thread_local! { static ON_RT_THREAD: Cell<bool> = Cell::new(false); } ON_RT_THREAD.with(|cell| cel...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/task_local_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_local_set.rs:6
} }) .await; } #[tokio::test(threaded_scheduler)] async fn nested_spawn_is_local() { thread_local! { static ON_RT_THREAD: Cell<bool> = Cell::new(false); } ON_RT_THREAD.with(|cell| cell.set(true)); LocalSet::new() .run_until(async { assert!(ON_RT_THREAD.with...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/task_local_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_local_set.rs:7
#[test] fn join_local_future_elsewhere() { thread_local! { static ON_RT_THREAD: Cell<bool> = Cell::new(false); } ON_RT_THREAD.with(|cell| cell.set(true)); let mut rt = runtime::Builder::new() .threaded_scheduler() .build() .unwrap(); let local = LocalSet::new(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/task_local_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_local_set.rs:8
}); } #[test] fn drop_cancels_tasks() { use std::rc::Rc; // This test reproduces issue #1842 let mut rt = rt(); let rc1 = Rc::new(()); let rc2 = rc1.clone(); let (started_tx, started_rx) = oneshot::channel(); let local = LocalSet::new(); local.spawn_local(async move { // Move...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/task_local_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_local_set.rs:9
use std::sync::mpsc::RecvTimeoutError; let (done_tx, done_rx) = std::sync::mpsc::channel(); let thread = std::thread::spawn(move || { f(); // Send a message on the channel so that the test thread can // determine if we have entered an infinite loop: done_tx.send(()).unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/task_local_set.rs
321
380
tokio-rs/tokio:tokio/tests/task_local_set.rs:10
// This test reproduces issue #1885. with_timeout(Duration::from_secs(60), || { let (tx, mut rx) = mpsc::channel::<()>(1024); let mut rt = rt(); let local = LocalSet::new(); local.spawn_local(async move { while rx.recv().await.is_some() {} }); local.block_on(&mut rt, async ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/task_local_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_local_set.rs:9
use std::sync::mpsc::RecvTimeoutError; let (done_tx, done_rx) = std::sync::mpsc::channel(); let thread = std::thread::spawn(move || { f(); // Send a message on the channel so that the test thread can // determine if we have entered an infinite loop: done_tx.send(()).unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
20b5df90372ac97d817d2e3666773dd9561f057f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20b5df90372ac97d817d2e3666773dd9561f057f/tokio/tests/task_local_set.rs
321
380
tokio-rs/tokio:tokio/tests/task_local_set.rs:10
// This test reproduces issue #1885. with_timeout(Duration::from_secs(60), || { let (tx, mut rx) = mpsc::channel::<()>(1024); let mut rt = rt(); let local = LocalSet::new(); local.spawn_local(async move { while let Some(_) = rx.recv().await {} }); local.block_on(&mut rt, as...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
20b5df90372ac97d817d2e3666773dd9561f057f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20b5df90372ac97d817d2e3666773dd9561f057f/tokio/tests/task_local_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_local_set.rs:8
}); } #[test] fn drop_cancels_tasks() { use std::rc::Rc; // This test reproduces issue #1842 let mut rt = rt(); let rc1 = Rc::new(()); let rc2 = rc1.clone(); let (started_tx, started_rx) = oneshot::channel(); let local = LocalSet::new(); local.spawn_local(async move { // Move...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/tests/task_local_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_local_set.rs:9
let thread = std::thread::spawn(move || { let (tx, mut rx) = mpsc::channel::<()>(1024); let mut rt = rt(); let local = LocalSet::new(); local.spawn_local(async move { while let Some(_) = rx.recv().await {} }); local.block_on(&mut rt, async { time::delay_for(Duration...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/tests/task_local_set.rs
321
380
tokio-rs/tokio:tokio/tests/task_local_set.rs:10
} // Test completed successfully! Ok(()) => {} } thread.join().expect("test thread should not panic!") } #[tokio::test] async fn local_tasks_are_polled_after_tick() { // Reproduces issues #1899 and #1900 static RX1: AtomicUsize = AtomicUsize::new(0); static RX2: AtomicUsize = Atom...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/tests/task_local_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_local_set.rs:11
time::delay_for(Duration::from_millis(300)).await; let rx1 = RX1.load(SeqCst); let rx2 = RX2.load(SeqCst); println!("EXPECT = {}; RX1 = {}; RX2 = {}", EXPECTED, rx1, rx2); assert_eq!(EXPECTED, rx1); assert_eq!(EXPECTED, rx2); })...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/tests/task_local_set.rs
401
460
tokio-rs/tokio:tokio/tests/task_local_set.rs:12
}); // Spawn a task that will never notify local.spawn_local(async move { pending::<()>().await; tx1.send(()).unwrap(); }); // Tick the loop local .run_until(async { task::yield_now().await; }) .await; // Drop the LocalSet drop(local); }...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/tests/task_local_set.rs
441
466
tokio-rs/tokio:tokio/tests/task_local_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::{ cell::Cell, sync::atomic::{ AtomicBool, AtomicUsize, Ordering::{self, SeqCst}, }, time::Duration, }; use tokio::{ runtime::{self, Runtime}, sync::{mpsc, oneshot}, task::{self, LocalSet}, time, }; #[tokio::t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
1
60
tokio-rs/tokio:tokio/tests/task_local_set.rs:2
}) .await .unwrap(); }) .await; } #[tokio::test(threaded_scheduler)] async fn localset_future_threadpool() { thread_local! { static ON_LOCAL_THREAD: Cell<bool> = Cell::new(false); } ON_LOCAL_THREAD.with(|cell| cell.set(true)); let local = LocalSet::new(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
41
100
tokio-rs/tokio:tokio/tests/task_local_set.rs:3
#[tokio::test] async fn localset_future_drives_all_local_futs() { static RAN1: AtomicBool = AtomicBool::new(false); static RAN2: AtomicBool = AtomicBool::new(false); static RAN3: AtomicBool = AtomicBool::new(false); let local = LocalSet::new(); local.spawn_local(async move { task::spawn_loc...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
81
140
tokio-rs/tokio:tokio/tests/task_local_set.rs:4
assert!(ON_RT_THREAD.with(|cell| cell.get())); time::delay_for(Duration::from_millis(10)).await; assert!(ON_RT_THREAD.with(|cell| cell.get())); }); join.await.unwrap(); }) .await; } #[test] // This will panic, since the thread that calls `block_on...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
121
180
tokio-rs/tokio:tokio/tests/task_local_set.rs:5
} ON_RT_THREAD.with(|cell| cell.set(true)); LocalSet::new() .run_until(async { assert!(ON_RT_THREAD.with(|cell| cell.get())); let join = task::spawn_local(async move { assert!(ON_RT_THREAD.with(|cell| cell.get())); task::spawn_blocking(|| { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
161
220
tokio-rs/tokio:tokio/tests/task_local_set.rs:6
}) }) .collect::<Vec<_>>(); for joined in future::join_all(handles).await { joined.unwrap(); } }) .await; } #[tokio::test(threaded_scheduler)] async fn nested_spawn_is_local() { thread_local! { static ON_RT_THREAD: Cell...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
201
260
tokio-rs/tokio:tokio/tests/task_local_set.rs:7
.unwrap(); }) .await; } #[test] fn join_local_future_elsewhere() { thread_local! { static ON_RT_THREAD: Cell<bool> = Cell::new(false); } ON_RT_THREAD.with(|cell| cell.set(true)); let mut rt = runtime::Builder::new() .threaded_scheduler() .build() .unwra...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
241
300
tokio-rs/tokio:tokio/tests/task_local_set.rs:8
join.await.expect("task should complete successfully"); println!("hello world task joined"); }); join2.await.unwrap() }); } #[test] fn drop_cancels_tasks() { // This test reproduces issue #1842 let mut rt = rt(); let (started_tx, started_rx) = oneshot::channel(); let l...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
281
340
tokio-rs/tokio:tokio/tests/task_local_set.rs:9
let local = LocalSet::new(); local.spawn_local(async move { while let Some(_) = rx.recv().await {} }); local.block_on(&mut rt, async { time::delay_for(Duration::from_millis(1)).await; }); drop(tx); // This enters an infinite loop if the remote notified tasks are not...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
321
380
tokio-rs/tokio:tokio/tests/task_local_set.rs:10
thread.join().expect("test thread should not panic!") } #[tokio::test] async fn local_tasks_are_polled_after_tick() { // Reproduces issues #1899 and #1900 static RX1: AtomicUsize = AtomicUsize::new(0); static RX2: AtomicUsize = AtomicUsize::new(0); static EXPECTED: usize = 500; let (tx, mut rx) =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
361
420
tokio-rs/tokio:tokio/tests/task_local_set.rs:11
assert_eq!(EXPECTED, rx1); assert_eq!(EXPECTED, rx2); }); while let Some(oneshot) = rx.recv().await { RX1.fetch_add(1, SeqCst); task::spawn_local(async move { oneshot.await.unwrap(); RX2.fetch_add(1, SeqCst...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
401
460
tokio-rs/tokio:tokio/tests/task_local_set.rs:12
tx1.send(()).unwrap(); }); // Tick the loop local .run_until(async { task::yield_now().await; }) .await; // Drop the LocalSet drop(local); } fn rt() -> Runtime { tokio::runtime::Builder::new() .basic_scheduler() .enable_all() .build(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
798e86821f6e06fba552bd670c5887ce3b6ff698
github
async-runtime
https://github.com/tokio-rs/tokio/blob/798e86821f6e06fba552bd670c5887ce3b6ff698/tokio/tests/task_local_set.rs
441
461
tokio-rs/tokio:tokio/tests/task_local_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio::task::{self, LocalSet}; #[test] fn acquire_mutex_in_drop() { use futures::future::pending; let (tx1, rx1) = oneshot::channel(); let (tx2, rx2) = oneshot::channel(); let mut rt = rt(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/task_local_set.rs
1
50
tokio-rs/tokio:tokio/tests/task_local_set.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio::task::{self, LocalSet}; #[test] fn acquire_mutex_in_drop() { use futures::future::pending; let (tx1, rx1) = oneshot::channel(); let (tx2, rx2) = oneshot::channel(); let mut rt = rt(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_local_set.rs
MIT
41d15ea212525f4be310d65c29c626488af546e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/41d15ea212525f4be310d65c29c626488af546e1/tokio/tests/task_local_set.rs
1
50
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] #![cfg(panic = "unwind")] use futures::future; use std::error::Error; use tokio::runtime::Builder; use tokio::task::{self, block_in_place}; mod support { pub mod panic; } use support::panic::test_panic; #[test] fn block_in_place_p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_panic.rs:2
Ok(()) } #[test] fn local_set_block_on_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = Builder::new_current_thread().enable_all().build().unwrap(); let local = task::LocalSet::new(); rt.block_on(async { local.block_on(&rt, futur...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_panic.rs
41
100
tokio-rs/tokio:tokio/tests/task_panic.rs:3
NUMBER.with(|_| { NUMBER.sync_scope(1, || {}); }); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[test] fn local_key_with_panic_caller() -> Result<(), Box<dyn Error>> { tokio::task_local! { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_panic.rs
81
123
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] use futures::future; use std::error::Error; use tokio::runtime::Builder; use tokio::task::{self, block_in_place}; mod support { pub mod panic; } use support::panic::test_panic; #[cfg(panic = "unwind")] #[test] fn block_in_place_pa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
84c5674c601dfc36ab417ff0ec01763c2dd30a5c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_panic.rs:2
Ok(()) } #[cfg(panic = "unwind")] #[test] fn local_set_block_on_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = Builder::new_current_thread().enable_all().build().unwrap(); let local = task::LocalSet::new(); rt.block_on(async { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
84c5674c601dfc36ab417ff0ec01763c2dd30a5c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/task_panic.rs
41
100
tokio-rs/tokio:tokio/tests/task_panic.rs:3
} let panic_location_file = test_panic(|| { NUMBER.sync_scope(1, || { NUMBER.with(|_| { NUMBER.sync_scope(1, || {}); }); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[cfg...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
84c5674c601dfc36ab417ff0ec01763c2dd30a5c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/task_panic.rs
81
129
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![allow(clippy::declare_interior_mutable_const)] #![cfg(all(feature = "full", not(target_os = "wasi")))] use futures::future; use std::error::Error; use tokio::runtime::Builder; use tokio::task::{self, block_in_place}; mod support { pub mod panic; } use support::panic::test_panic; #[c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_panic.rs:2
assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[cfg(panic = "unwind")] #[test] fn local_set_block_on_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = Builder::new_current_thread().enable_all().build().unwrap(); let local = task::L...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/task_panic.rs
41
100
tokio-rs/tokio:tokio/tests/task_panic.rs:3
static NUMBER: u32; } let panic_location_file = test_panic(|| { NUMBER.sync_scope(1, || { NUMBER.with(|_| { NUMBER.sync_scope(1, || {}); }); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/task_panic.rs
81
130
tokio-rs/tokio:tokio/tests/task_panic.rs:4
let panic_location_file = test_panic(|| { NUMBER.get(); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/task_panic.rs
121
130
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![allow(clippy::declare_interior_mutable_const)] #![cfg(all(feature = "full", not(target_os = "wasi")))] use futures::future; use std::error::Error; use tokio::runtime::Builder; use tokio::task::{self, block_in_place}; mod support { pub mod panic; } use support::panic::test_panic; #[t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![allow(clippy::declare_interior_mutable_const)] #![cfg(all(feature = "full", not(tokio_wasi)))] use futures::future; use std::error::Error; use tokio::runtime::Builder; use tokio::task::{self, block_in_place}; mod support { pub mod panic; } use support::panic::test_panic; #[test] fn ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
fc9518b62714daac9a38b46c698b94ac5d5b1ca2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] use futures::future; use std::error::Error; use tokio::runtime::Builder; use tokio::task::{self, block_in_place}; mod support { pub mod panic; } use support::panic::test_panic; #[test] fn block_in_place_panic_caller() -> Result<(), Box<dy...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
7096a8007502526b23ee1707a6cb37c68c4f0a84
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7096a8007502526b23ee1707a6cb37c68c4f0a84/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_panic.rs:2
} #[test] fn local_set_block_on_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = Builder::new_current_thread().enable_all().build().unwrap(); let local = task::LocalSet::new(); rt.block_on(async { local.block_on(&rt, future::pend...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
7096a8007502526b23ee1707a6cb37c68c4f0a84
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7096a8007502526b23ee1707a6cb37c68c4f0a84/tokio/tests/task_panic.rs
41
100
tokio-rs/tokio:tokio/tests/task_panic.rs:3
let _ = NUMBER.sync_scope(1, || {}); }); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[test] fn local_key_with_panic_caller() -> Result<(), Box<dyn Error>> { tokio::task_local! { static NUMBER: u32; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
7096a8007502526b23ee1707a6cb37c68c4f0a84
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7096a8007502526b23ee1707a6cb37c68c4f0a84/tokio/tests/task_panic.rs
81
122
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] use futures::future; use std::error::Error; use tokio::{runtime::Builder, spawn, task}; mod support { pub mod panic; } use support::panic::test_panic; #[test] fn local_set_block_on_panic_caller() -> Result<(), Box<dyn Error>> { let pa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_panic.rs:2
#[test] fn local_key_sync_scope_panic_caller() -> Result<(), Box<dyn Error>> { tokio::task_local! { static NUMBER: u32; } let panic_location_file = test_panic(|| { NUMBER.sync_scope(1, || { NUMBER.with(|_| { let _ = NUMBER.sync_scope(1, || {}); }); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/task_panic.rs
41
92
tokio-rs/tokio:tokio/tests/task_panic.rs:3
static NUMBER: u32; } let panic_location_file = test_panic(|| { NUMBER.get(); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/task_panic.rs
81
92
tokio-rs/tokio:tokio/tests/task_panic.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] use futures::future; use std::error::Error; use tokio::{runtime::Builder, spawn, task}; mod support { pub mod panic; } use support::panic::test_panic; #[test] fn local_set_block_on_panic_caller() -> Result<(), Box<dyn Error>> { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_panic.rs
MIT
5288e1e144d33ace0070325b16029523b1db0ffe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5288e1e144d33ace0070325b16029523b1db0ffe/tokio/tests/task_panic.rs
1
60
tokio-rs/tokio:tokio/tests/task_trace_self.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all( tokio_unstable, feature = "taskdump", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") ))] use std::future::Future; use std::pin::Pin; use std::ptr; use std::sync::{Arc, Mutex}; use std::task::{Context, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_trace_self.rs
1
60
tokio-rs/tokio:tokio/tests/task_trace_self.rs:2
} impl<F: Future> Future for PrettyFuture<F> { type Output = F::Output; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> { let mut this = self.project(); let now = Instant::now(); let t_last = match this.t_last { State::Running { since } => Some(*since...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_trace_self.rs
41
100
tokio-rs/tokio:tokio/tests/task_trace_self.rs:3
PrettyFuture::pretty( async { bad_line.push(line!() + 1); tokio::task::yield_now().await; bad_line.push(line!() + 1); tokio::time::sleep(Duration::from_millis(1)).await; for _ in 0..100 { good_line.push(line!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_trace_self.rs
81
140
tokio-rs/tokio:tokio/tests/task_trace_self.rs:4
if let Some(root_addr) = meta.root_addr { backtrace::trace(|frame| { let below_root = !ptr::eq(frame.symbol_address(), root_addr); if above_leaf && below_root { frames.push(frame.to_owned().into()); } if ptr::eq(frame.symbol_address(), meta.trace...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_trace_self.rs
121
180
tokio-rs/tokio:tokio/tests/task_trace_self.rs:5
} s } pin_project_lite::pin_project! { /// A future wrapper that uses `trace_with` to capture a backtrace on every /// poll. /// The captured backtraces are stored in `logs`. pub struct TaskDump<F: Future> { #[pin] f: Root<F>, logs: Arc<Mutex<Vec<Vec<String>>>>, } } imp...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_trace_self.rs
161
220
tokio-rs/tokio:tokio/tests/task_trace_self.rs:6
|meta| trace_leaf_for_test(meta, &mut logs), ); // trace should always produce poll pending assert!( matches!(trace_poll, Poll::Pending), "expected trace to produce Poll::Pending but it was ready" ); // Drain any frames captured by trace_leaf_for_test int...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_trace_self.rs
201
260
tokio-rs/tokio:tokio/tests/task_trace_self.rs:7
assert_eq!( captured.len(), 1, "expected exactly 1 traces, got {:#?}", *captured ); // These symbols should appear in the trace in this exact order (substring match). // trace_leaf itself should NOT appear — it's the boundary frame. let expected_in_order = [ "tok...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_trace_self.rs
241
274
tokio-rs/tokio:tokio/tests/task_trace_self.rs:2
} impl<F: Future> Future for PrettyFuture<F> { type Output = F::Output; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> { let mut this = self.project(); let now = Instant::now(); let t_last = match this.t_last { State::Running { since } => Some(*since...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
36d12d2686a64b9146c674e02e3cf81d8f87163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36d12d2686a64b9146c674e02e3cf81d8f87163d/tokio/tests/task_trace_self.rs
41
100
tokio-rs/tokio:tokio/tests/task_trace_self.rs:3
bad_line.push(line!() + 1); tokio::time::sleep(Duration::from_millis(1)).await; for _ in 0..100 { good_line.push(line!() + 1); tokio::time::sleep(Duration::from_millis(10)).await; } }, log.clone(), ),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
36d12d2686a64b9146c674e02e3cf81d8f87163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36d12d2686a64b9146c674e02e3cf81d8f87163d/tokio/tests/task_trace_self.rs
81
140
tokio-rs/tokio:tokio/tests/task_trace_self.rs:4
if above_leaf && below_root { frames.push(frame.to_owned().into()); } if ptr::eq(frame.symbol_address(), meta.trace_leaf_addr) { above_leaf = true; } below_root }); } // Resolve frames into human-readable symbol names wit...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
36d12d2686a64b9146c674e02e3cf81d8f87163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36d12d2686a64b9146c674e02e3cf81d8f87163d/tokio/tests/task_trace_self.rs
121
180
tokio-rs/tokio:tokio/tests/task_trace_self.rs:5
pin_project_lite::pin_project! { /// A future wrapper that uses `trace_with` to capture a backtrace on every /// poll. /// The captured backtraces are stored in `logs`. pub struct TaskDump<F: Future> { #[pin] f: Root<F>, logs: Arc<Mutex<Vec<Vec<String>>>>, } } impl<F: Future...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
36d12d2686a64b9146c674e02e3cf81d8f87163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36d12d2686a64b9146c674e02e3cf81d8f87163d/tokio/tests/task_trace_self.rs
161
220
tokio-rs/tokio:tokio/tests/task_trace_self.rs:6
|| this.f.as_mut().poll(&mut noop_cx), |meta| trace_leaf_for_test(meta, &mut logs), ); // trace should always produce poll pending assert!( matches!(trace_poll, Poll::Pending), "expected trace to produce Poll::Pending but it was ready" ); // D...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
36d12d2686a64b9146c674e02e3cf81d8f87163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36d12d2686a64b9146c674e02e3cf81d8f87163d/tokio/tests/task_trace_self.rs
201
260
tokio-rs/tokio:tokio/tests/task_trace_self.rs:7
let captured = logs.lock().unwrap(); assert_eq!( captured.len(), 1, "expected exactly 1 traces, got {:#?}", *captured ); // These symbols should appear in the trace in this exact order (substring match). // trace_leaf itself should NOT appear — it's the boundary frame. ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
36d12d2686a64b9146c674e02e3cf81d8f87163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36d12d2686a64b9146c674e02e3cf81d8f87163d/tokio/tests/task_trace_self.rs
241
275
tokio-rs/tokio:tokio/tests/task_trace_self.rs:3
bad_line.push(line!() + 1); tokio::time::sleep(Duration::from_millis(1)).await; for _ in 0..100 { good_line.push(line!() + 1); tokio::time::sleep(Duration::from_millis(10)).await; } }, log.clone(), ),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
bbdba7101de6ce5329d84021ce669f185cc430b3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bbdba7101de6ce5329d84021ce669f185cc430b3/tokio/tests/task_trace_self.rs
81
140
tokio-rs/tokio:tokio/tests/task_trace_self.rs:4
let below_root = !ptr::eq(frame.symbol_address(), root_addr); if above_leaf && below_root { frames.push(frame.to_owned().into()); } if ptr::eq(frame.symbol_address(), meta.trace_leaf_addr) { above_leaf = true; } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
bbdba7101de6ce5329d84021ce669f185cc430b3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bbdba7101de6ce5329d84021ce669f185cc430b3/tokio/tests/task_trace_self.rs
121
180
tokio-rs/tokio:tokio/tests/task_trace_self.rs:5
if !suffix.is_empty() && suffix.chars().all(|c| c.is_ascii_hexdigit()) { return &s[..pos]; } } s } pin_project_lite::pin_project! { /// A future wrapper that uses `trace_with` to capture a backtrace on every /// poll. /// The captured backtraces are stored in `logs`. pub str...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
bbdba7101de6ce5329d84021ce669f185cc430b3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bbdba7101de6ce5329d84021ce669f185cc430b3/tokio/tests/task_trace_self.rs
161
220
tokio-rs/tokio:tokio/tests/task_trace_self.rs:6
// point, trace_leaf fires our callback and returns Pending. We discard // the result — this poll is purely for capturing the backtrace. let noop = futures::task::noop_waker(); let mut noop_cx = Context::from_waker(&noop); let logs = this.logs.clone(); let trace_poll = trace_with...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
bbdba7101de6ce5329d84021ce669f185cc430b3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bbdba7101de6ce5329d84021ce669f185cc430b3/tokio/tests/task_trace_self.rs
201
260
tokio-rs/tokio:tokio/tests/task_trace_self.rs:7
}, logs.clone(), ) .await; assert_eq!(result, 42); let captured = logs.lock().unwrap(); assert_eq!( captured.len(), 1, "expected exactly 1 traces, got {:#?}", *captured ); // These symbols should appear in the trace in this exact order (substring m...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
bbdba7101de6ce5329d84021ce669f185cc430b3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bbdba7101de6ce5329d84021ce669f185cc430b3/tokio/tests/task_trace_self.rs
241
282
tokio-rs/tokio:tokio/tests/task_trace_self.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all( tokio_unstable, feature = "taskdump", target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") ))] use std::future::Future; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use std...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/tests/task_trace_self.rs
1
60
tokio-rs/tokio:tokio/tests/task_trace_self.rs:2
impl<F: Future> Future for PrettyFuture<F> { type Output = F::Output; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> { let mut this = self.project(); let now = Instant::now(); let t_last = match this.t_last { State::Running { since } => Some(*since), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/tests/task_trace_self.rs
41
100
tokio-rs/tokio:tokio/tests/task_trace_self.rs:3
tokio::time::sleep(Duration::from_millis(1)).await; for _ in 0..100 { good_line.push(line!() + 1); tokio::time::sleep(Duration::from_millis(10)).await; } }, log.clone(), ), log2.clone(), ) .await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
d1f1499f630c34c1d319acdc2cc86d7a1008c4b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/tests/task_trace_self.rs
81
107
tokio-rs/tokio:tokio/tests/task_trace_self.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all( tokio_unstable, tokio_taskdump, target_os = "linux", any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") ))] use std::future::Future; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use std::time...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/tests/task_trace_self.rs
1
60
tokio-rs/tokio:tokio/tests/task_trace_self.rs:2
impl<F: Future> Future for PrettyFuture<F> { type Output = F::Output; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> { let mut this = self.project(); let now = Instant::now(); let t_last = match this.t_last { State::Running { since } => Some(*since), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
2671ffb55b8f2464c0f1c3c7d99ee70118108755
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2671ffb55b8f2464c0f1c3c7d99ee70118108755/tokio/tests/task_trace_self.rs
41
100
tokio-rs/tokio:tokio/tests/task_trace_self.rs:3
tokio::time::sleep(Duration::from_millis(1)).await; for _ in 0..100 { good_line.push(line!() + 1); tokio::time::sleep(Duration::from_millis(10)).await; } }, log.clone(), ), log2.clone(), ) .await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_trace_self.rs
MIT
2671ffb55b8f2464c0f1c3c7d99ee70118108755
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2671ffb55b8f2464c0f1c3c7d99ee70118108755/tokio/tests/task_trace_self.rs
81
107
tokio-rs/tokio:tokio/tests/task_yield_now.rs:1
#![cfg(all(feature = "full", not(target_os = "wasi"), tokio_unstable))] use tokio::task; use tokio_test::task::spawn; // `yield_now` is tested within the runtime in `rt_common`. #[test] fn yield_now_outside_of_runtime() { let mut task = spawn(async { task::yield_now().await; }); assert!(task.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_yield_now.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_yield_now.rs
1
24
tokio-rs/tokio:tokio/tests/task_yield_now.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all(feature = "full", not(target_os = "wasi"), tokio_unstable))] use tokio::task; use tokio_test::task::spawn; // `yield_now` is tested within the runtime in `rt_common`. #[test] fn yield_now_outside_of_runtime() { let mut task = spawn(async { task::yield_n...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_yield_now.rs
MIT
f8948ea021bd4b5626bbd8dee89bee51ba766326
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f8948ea021bd4b5626bbd8dee89bee51ba766326/tokio/tests/task_yield_now.rs
1
25
tokio-rs/tokio:tokio/tests/task_yield_now.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all(feature = "full", tokio_unstable))] use tokio::task; use tokio_test::task::spawn; // `yield_now` is tested within the runtime in `rt_common`. #[test] fn yield_now_outside_of_runtime() { let mut task = spawn(async { task::yield_now().await; }); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_yield_now.rs
MIT
2a0df5fb05ae1a624fe2f6db756190f41812214b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/task_yield_now.rs
1
17
tokio-rs/tokio:tokio/tests/task_yield_now.rs:1
#![cfg(all(feature = "full", tokio_unstable))] use tokio::task; use tokio_test::task::spawn; // `yield_now` is tested within the runtime in `rt_common`. #[test] fn yield_now_outside_of_runtime() { let mut task = spawn(async { task::yield_now().await; }); assert!(task.poll().is_pending()); ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_yield_now.rs
MIT
c748f4965eae883a2291945116d84cab5d657100
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/tests/task_yield_now.rs
1
16
tokio-rs/tokio:tokio/tests/tcp_accept.rs:1
#![warn(rust_2018_idioms)] // WASIp1 doesn't support bind // No `socket` on miri. #![cfg(all( feature = "net", feature = "macros", feature = "rt", feature = "io-util", not(all(target_os = "wasi", target_env = "p1")), not(miri) ))] use tokio::net::{TcpListener, TcpStream}; use tokio::sync::{mpsc...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/tcp_accept.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_accept.rs
1
60
tokio-rs/tokio:tokio/tests/tcp_accept.rs:2
)* } } test_accept! { (ip_str, "127.0.0.1:0"), // Note that WASIp2 _does_ support asynchronous name lookups without // requiring a worker thread, so this test could be ungated if/when that's // implemented. #[cfg_attr(target_os = "wasi", ignore = "net::lookup_host requires multithreading, which...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/tcp_accept.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_accept.rs
41
100
tokio-rs/tokio:tokio/tests/tcp_accept.rs:3
let mut listener = assert_ok!(TcpListener::bind("127.0.0.1:0").await); let addr = listener.local_addr().unwrap(); let (tx, rx) = oneshot::channel(); let (accepted_tx, mut accepted_rx) = mpsc::unbounded_channel(); tokio::spawn(async move { let mut incoming = TrackPolls { npolls: Arc...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/tcp_accept.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_accept.rs
81
140
tokio-rs/tokio:tokio/tests/tcp_accept.rs:4
let connected = Arc::new(AtomicBool::new(false)); let (pending_tx, mut pending_rx) = mpsc::unbounded_channel(); let (notified_tx, mut notified_rx) = mpsc::unbounded_channel(); for _ in 0..N { let listener = listener.clone(); let connected = connected.clone(); let pending_tx = pendi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/tcp_accept.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_accept.rs
121
170
tokio-rs/tokio:tokio/tests/tcp_accept.rs:5
// Establish a TCP connection connected.store(true, SeqCst); let _sock = TcpStream::connect(addr).await.unwrap(); // Wait for all notifications for _ in 0..N { notified_rx.recv().await.unwrap(); } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/tcp_accept.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/tcp_accept.rs
161
170