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/rt_threaded.rs:20
// // Spawning a task will wake up the second worker, which will then steal // the task. However, the steal will fail if the task is in the LIFO // slot, because the LIFO slot cannot be stolen. // // Note that this only happens rarely. Most of the time, this thread is // ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
310adf7ca69957703dc4b1c43f4932b26539bcc7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/310adf7ca69957703dc4b1c43f4932b26539bcc7/tokio/tests/rt_threaded.rs
761
808
tokio-rs/tokio:tokio/tests/rt_threaded.rs:19
} if Arc::strong_count(&interval) <= 5_000 { let counter = counter.clone(); let interval = interval.clone(); rt.spawn(async move { let prev = counter.swap(0, Relaxed); interval.store(prev, Relaxed); }); } std::thr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_threaded.rs
721
780
tokio-rs/tokio:tokio/tests/rt_threaded.rs:20
.await .unwrap(); }) } #[test] fn runtime_id_is_same() { let rt = rt(); let handle1 = rt.handle(); let handle2 = rt.handle(); assert_eq!(handle1.id(), handle2.id()); } #[test] fn runtime_ids_different() { let rt1 = rt(); let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_threaded.rs
761
783
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:19
} if Arc::strong_count(&interval) <= 5_000 { let counter = counter.clone(); let interval = interval.clone(); rt.spawn(async move { let prev = counter.swap(0, Relaxed); interval.store(prev, Relaxed); }); } std::thr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
6e990eb2c814d7f327b773714d6ea6982fdd9b9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6e990eb2c814d7f327b773714d6ea6982fdd9b9c/tokio/tests/rt_threaded.rs
721
765
tokio-rs/tokio:tokio/tests/rt_threaded.rs:15
rt.spawn(f1); rt.spawn(f2); rt.block_on(async { tokio::time::sleep(tokio::time::Duration::from_millis(20)).await }); } #[should_panic] #[tokio::test] async fn test_block_in_place1() { tokio::task::block_in_place(|| {}); } #[tokio::test(flavor = "multi_thread")] async fn test_block_in_place2() { tokio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
779b9c19d5c373d4d89ef3d758cf7469e9941c31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/779b9c19d5c373d4d89ef3d758cf7469e9941c31/tokio/tests/rt_threaded.rs
561
620
tokio-rs/tokio:tokio/tests/rt_threaded.rs:16
let rt = runtime::Builder::new_multi_thread() .worker_threads(1) .build() .unwrap(); fn iter(flag: Arc<AtomicBool>, counter: Arc<AtomicUsize>, stall: bool) { if flag.load(Relaxed) { if stall { std::thread::sleep(Duration::from_micros(5)); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
779b9c19d5c373d4d89ef3d758cf7469e9941c31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/779b9c19d5c373d4d89ef3d758cf7469e9941c31/tokio/tests/rt_threaded.rs
601
660
tokio-rs/tokio:tokio/tests/rt_threaded.rs:17
// state. if n == 3 { break; } if Arc::strong_count(&interval) < 5_000 { let counter = counter.clone(); let interval = interval.clone(); rt.spawn(async move { let prev = counter.swap(0, Relaxed); interval.store(pre...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
779b9c19d5c373d4d89ef3d758cf7469e9941c31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/779b9c19d5c373d4d89ef3d758cf7469e9941c31/tokio/tests/rt_threaded.rs
641
700
tokio-rs/tokio:tokio/tests/rt_threaded.rs:18
let mut n = 0; loop { let curr = interval.load(Relaxed); if curr <= 1_000 && curr > 32 { n += 1; } else { n = 0; } if n == 3 { break; } if Arc::strong_count(&interval) <= 5_000 { let counter = counter.clone();...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
779b9c19d5c373d4d89ef3d758cf7469e9941c31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/779b9c19d5c373d4d89ef3d758cf7469e9941c31/tokio/tests/rt_threaded.rs
681
737
tokio-rs/tokio:tokio/tests/rt_threaded.rs:19
let rt = runtime::Builder::new_multi_thread() .disable_lifo_slot() .worker_threads(2) .build() .unwrap(); rt.block_on(async { tokio::spawn(async { // Spawn another task and block the thread until completion. If the LIFO slot ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
779b9c19d5c373d4d89ef3d758cf7469e9941c31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/779b9c19d5c373d4d89ef3d758cf7469e9941c31/tokio/tests/rt_threaded.rs
721
737
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:12
.await .unwrap(); }); } #[test] fn yield_after_block_in_place() { let rt = tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .build() .unwrap(); rt.block_on(async { tokio::spawn(async move { // Block in place then enter a new runtime ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
441
500
tokio-rs/tokio:tokio/tests/rt_threaded.rs:13
#[test] #[should_panic] fn max_blocking_threads_set_to_zero() { let _rt = tokio::runtime::Builder::new_multi_thread() .max_blocking_threads(0) .build() .unwrap(); } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn hang_on_shutdown() { let (sync_tx, sync_rx) = std::sy...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
481
540
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
put_waker: true, }; let f2 = MyFuture { shared, put_waker: false, }; (f1, f2) } } impl Future for MyFuture { type Output = (); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { l...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
521
580
tokio-rs/tokio:tokio/tests/rt_threaded.rs:15
rt.spawn(f1); rt.spawn(f2); rt.block_on(async { tokio::time::sleep(tokio::time::Duration::from_millis(20)).await }); } #[should_panic] #[tokio::test] async fn test_block_in_place1() { tokio::task::block_in_place(|| {}); } #[tokio::test(flavor = "multi_thread")] async fn test_block_in_place2() { tokio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
561
620
tokio-rs/tokio:tokio/tests/rt_threaded.rs:16
use std::time::Duration; let rt = runtime::Builder::new_multi_thread() .worker_threads(1) .build() .unwrap(); fn iter(flag: Arc<AtomicBool>, counter: Arc<AtomicUsize>, stall: bool) { if flag.load(Relaxed) { if stall { std::thread::sleep(Duration::fro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
601
660
tokio-rs/tokio:tokio/tests/rt_threaded.rs:18
// Now, hammer the injection queue until the interval reaches the expected range. let mut n = 0; loop { let curr = interval.load(Relaxed); if curr <= 1_000 && curr > 32 { n += 1; } else { n = 0; } if n == 3 { break; } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
681
738
tokio-rs/tokio:tokio/tests/rt_threaded.rs:19
fn test_disable_lifo_slot() { let rt = runtime::Builder::new_multi_thread() .disable_lifo_slot() .worker_threads(2) .build() .unwrap(); rt.block_on(async { tokio::spawn(async { // Spawn another task and block the thread until c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
1e14ef00939f62f31a00bbef260d82185171c6d5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e14ef00939f62f31a00bbef260d82185171c6d5/tokio/tests/rt_threaded.rs
721
738
tokio-rs/tokio:tokio/tests/rt_threaded.rs:16
use std::time::Duration; let rt = runtime::Builder::new_multi_thread() .worker_threads(1) .build() .unwrap(); fn iter(flag: Arc<AtomicBool>, counter: Arc<AtomicUsize>, stall: bool) { if flag.load(Relaxed) { if stall { std::thread::sleep(Duration::fro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/tests/rt_threaded.rs
601
660
tokio-rs/tokio:tokio/tests/rt_threaded.rs:17
// Make sure we get a few good rounds. Jitter in the tuning could result // in one "good" value without being representative of reaching a good // state. if n == 3 { break; } let counter = counter.clone(); let interval = interval.clone(); if i <= 5_0...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/tests/rt_threaded.rs
641
700
tokio-rs/tokio:tokio/tests/rt_threaded.rs:18
rt.spawn(async move { iter(flag, counter, false) }); } // Now, hammer the injection queue until the interval reaches the expected range. let mut i = 0; let mut n = 0; loop { let curr = interval.load(Relaxed); if curr <= 1_000 && curr > 32 { n += 1; } else { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/tests/rt_threaded.rs
681
740
tokio-rs/tokio:tokio/tests/rt_threaded.rs:19
} #[cfg(tokio_unstable)] mod unstable { use super::*; #[test] fn test_disable_lifo_slot() { let rt = runtime::Builder::new_multi_thread() .disable_lifo_slot() .worker_threads(2) .build() .unwrap(); rt.block_on(async { tokio::spaw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/tests/rt_threaded.rs
721
745
tokio-rs/tokio:tokio/tests/rt_threaded.rs:15
rt.spawn(f1); rt.spawn(f2); rt.block_on(async { tokio::time::sleep(tokio::time::Duration::from_millis(20)).await }); } #[should_panic] #[tokio::test] async fn test_block_in_place1() { tokio::task::block_in_place(|| {}); } #[tokio::test(flavor = "multi_thread")] async fn test_block_in_place2() { tokio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
70364b707975b84daf223915d60a1610de2539a2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/70364b707975b84daf223915d60a1610de2539a2/tokio/tests/rt_threaded.rs
561
617
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:2
for _ in 0..5 { let (tx, rx) = mpsc::channel(); let rt = rt(); let cnt = Arc::new(AtomicUsize::new(0)); for _ in 0..NUM { let cnt = cnt.clone(); let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
41
100
tokio-rs/tokio:tokio/tests/rt_threaded.rs:3
}); assert_eq!(out, "ZOMG"); cfg_metrics! { let metrics = rt.metrics(); drop(rt); assert_eq!(1, metrics.remote_schedule_count()); let mut local = 0; for i in 0..metrics.num_workers() { local += metrics.worker_local_schedule_count(i); } asse...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
81
140
tokio-rs/tokio:tokio/tests/rt_threaded.rs:4
}); chain_rx = next_rx; } // This final task cycles if needed let (final_tx, final_rx) = tokio::sync::mpsc::channel(10); let cycle_tx = start_tx.clone(); let mut rem = CYCLES; rt.spawn(async move { for _ in 0..CYC...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
121
180
tokio-rs/tokio:tokio/tests/rt_threaded.rs:5
} #[test] fn spawn_shutdown() { let rt = rt(); let (tx, rx) = mpsc::channel(); rt.block_on(async { tokio::spawn(client_server(tx.clone())); }); // Use spawner rt.spawn(client_server(tx)); assert_ok!(rx.recv()); assert_ok!(rx.recv()); drop(rt); assert_err!(rx.try_recv...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
161
220
tokio-rs/tokio:tokio/tests/rt_threaded.rs:6
assert_eq!(buf, b"hello"); tx.send(()).unwrap(); } #[test] fn drop_threadpool_drops_futures() { for _ in 0..1_000 { let num_inc = Arc::new(AtomicUsize::new(0)); let num_dec = Arc::new(AtomicUsize::new(0)); let num_drop = Arc::new(AtomicUsize::new(0)); struct Never(Arc<AtomicUsi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
201
260
tokio-rs/tokio:tokio/tests/rt_threaded.rs:7
.unwrap(); rt.spawn(Never(num_drop.clone())); // Wait for the pool to shutdown drop(rt); // Assert that only a single thread was spawned. let a = num_inc.load(Relaxed); assert!(a >= 1); // Assert that all threads shutdown let b = num_dec.load(Relaxed);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
241
300
tokio-rs/tokio:tokio/tests/rt_threaded.rs:8
let (tx, rx) = oneshot::channel(); rt.spawn(async move { assert_ok!(tx.send(())); }); assert_ok!(rt.block_on(rx)); drop(rt); assert!(after_start.load(Ordering::Relaxed) > 0); assert!(before_stop.load(Ordering::Relaxed) > 0); } #[test] fn blocking() { // used for notifying the ma...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
281
340
tokio-rs/tokio:tokio/tests/rt_threaded.rs:9
for _ in 0..NUM { let cnt = cnt.clone(); let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
321
380
tokio-rs/tokio:tokio/tests/rt_threaded.rs:10
} // When `block_in_place` returns, it attempts to reclaim the yielded runtime // worker. In this case, the remainder of the task is on the runtime worker and // must take part in the cooperative task budgeting system. // // The test ensures that, when this happens, attempting to consume from a // channel yields occas...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
361
420
tokio-rs/tokio:tokio/tests/rt_threaded.rs:11
Pin::new(&mut fut).poll(cx) } { if v.is_none() { panic!("did not yield"); } } Poll::Ready(()) }) .await }) .await .unwrap(); }); } #[test] fn yield_after_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
401
460
tokio-rs/tokio:tokio/tests/rt_threaded.rs:12
}); } // Testing this does not panic #[test] fn max_blocking_threads() { let _rt = tokio::runtime::Builder::new_multi_thread() .max_blocking_threads(1) .build() .unwrap(); } #[test] #[should_panic] fn max_blocking_threads_set_to_zero() { let _rt = tokio::runtime::Builder::new_multi_thr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
441
500
tokio-rs/tokio:tokio/tests/rt_threaded.rs:13
} struct MyFuture { shared: Arc<Mutex<Shared>>, put_waker: bool, } impl MyFuture { fn new() -> (Self, Self) { let shared = Arc::new(Mutex::new(Shared { waker: None })); let f1 = MyFuture { shared: shared.clone(), put_waker: tr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
481
540
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
} drop(lock); } } let rt = tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .enable_all() .build() .unwrap(); let (f1, f2) = MyFuture::new(); rt.spawn(f1); rt.spawn(f2); rt.block_on(async { tokio::time::sleep(tokio::time::Dura...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
521
580
tokio-rs/tokio:tokio/tests/rt_threaded.rs:15
tokio::task::block_in_place(|| {}); } fn rt() -> runtime::Runtime { runtime::Runtime::new().unwrap() } #[cfg(tokio_unstable)] mod unstable { use super::*; #[test] fn test_disable_lifo_slot() { let rt = runtime::Builder::new_multi_thread() .disable_lifo_slot() .worker_t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d1b789f33aa9d2bbca84f24b810235a10b149e92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d1b789f33aa9d2bbca84f24b810235a10b149e92/tokio/tests/rt_threaded.rs
561
590
tokio-rs/tokio:tokio/tests/rt_threaded.rs:10
} // When `block_in_place` returns, it attempts to reclaim the yielded runtime // worker. In this case, the remainder of the task is on the runtime worker and // must take part in the cooperative task budgeting system. // // The test ensures that, when this happens, attempting to consume from a // channel yields occas...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
121f839b4b6e0c2f3ac213dfd3c89796914b14ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/121f839b4b6e0c2f3ac213dfd3c89796914b14ef/tokio/tests/rt_threaded.rs
361
420
tokio-rs/tokio:tokio/tests/rt_threaded.rs:11
Pin::new(&mut fut).poll(cx) } { if v.is_none() { panic!("did not yield"); } } Poll::Ready(()) }) .await }) .await .unwrap(); }); } // Testing this does no...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
121f839b4b6e0c2f3ac213dfd3c89796914b14ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/121f839b4b6e0c2f3ac213dfd3c89796914b14ef/tokio/tests/rt_threaded.rs
401
460
tokio-rs/tokio:tokio/tests/rt_threaded.rs:12
}); tokio::spawn(async { tokio::time::sleep(std::time::Duration::from_secs(2)).await; drop(sync_tx); }); tokio::time::sleep(std::time::Duration::from_secs(1)).await; } /// Demonstrates tokio-rs/tokio#3869 #[test] fn wake_during_shutdown() { struct Shared { waker: Option<Waker>,...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
121f839b4b6e0c2f3ac213dfd3c89796914b14ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/121f839b4b6e0c2f3ac213dfd3c89796914b14ef/tokio/tests/rt_threaded.rs
441
500
tokio-rs/tokio:tokio/tests/rt_threaded.rs:13
let me = Pin::into_inner(self); let mut lock = me.shared.lock().unwrap(); if me.put_waker { lock.waker = Some(cx.waker().clone()); } Poll::Pending } } impl Drop for MyFuture { fn drop(&mut self) { let mut lock = self.sh...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
121f839b4b6e0c2f3ac213dfd3c89796914b14ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/121f839b4b6e0c2f3ac213dfd3c89796914b14ef/tokio/tests/rt_threaded.rs
481
540
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test] async fn test_block_in_place4() { tokio::task::block_in_place(|| {}); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
121f839b4b6e0c2f3ac213dfd3c89796914b14ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/121f839b4b6e0c2f3ac213dfd3c89796914b14ef/tokio/tests/rt_threaded.rs
521
564
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test] async fn test_block_in_place4() { tokio::task::block_in_place(|| {}); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
4bcd08b9384a862ed65a7418f4c87b03c688d271
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4bcd08b9384a862ed65a7418f4c87b03c688d271/tokio/tests/rt_threaded.rs
521
580
tokio-rs/tokio:tokio/tests/rt_threaded.rs:15
.await .unwrap(); }) } #[test] fn rng_seed() { let seed = b"bytes used to generate seed"; let rt1 = tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .rng_seed(RngSeed::from_bytes(seed)) .build() .unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
4bcd08b9384a862ed65a7418f4c87b03c688d271
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4bcd08b9384a862ed65a7418f4c87b03c688d271/tokio/tests/rt_threaded.rs
561
609
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test] async fn test_block_in_place4() { tokio::task::block_in_place(|| {}); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
9b486357ed1aa008afa09e95965eb6c94a8753a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/rt_threaded.rs
521
580
tokio-rs/tokio:tokio/tests/rt_threaded.rs:15
.await .unwrap(); }) } #[test] fn rng_seed() { let seed = b"bytes used to generate seed"; let rt1 = tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .rng_seed(RngSeed::from_bytes(seed)) .build() .unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
9b486357ed1aa008afa09e95965eb6c94a8753a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/rt_threaded.rs
561
605
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test] async fn test_block_in_place4() { tokio::task::block_in_place(|| {}); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/tests/rt_threaded.rs
521
580
tokio-rs/tokio:tokio/tests/rt_threaded.rs:15
.await .unwrap(); }) } #[test] fn rng_seed() { let seed = b"bytes used to generate seed"; let rt = tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .rng_seed(RngSeed::from_bytes(seed)) .build() .unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/tests/rt_threaded.rs
561
588
tokio-rs/tokio:tokio/tests/rt_threaded.rs:12
}); tokio::spawn(async { tokio::time::sleep(std::time::Duration::from_secs(2)).await; drop(sync_tx); }); tokio::time::sleep(std::time::Duration::from_secs(1)).await; } /// Demonstrates tokio-rs/tokio#3869 #[test] fn wake_during_shutdown() { struct Shared { waker: Option<Waker>,...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/tests/rt_threaded.rs
441
500
tokio-rs/tokio:tokio/tests/rt_threaded.rs:13
let me = Pin::into_inner(self); let mut lock = me.shared.lock().unwrap(); println!("poll {}", me.put_waker); if me.put_waker { println!("putting"); lock.waker = Some(cx.waker().clone()); } Poll::Pending } } impl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/tests/rt_threaded.rs
481
540
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
tokio::task::block_in_place(|| {}); } #[tokio::test(flavor = "multi_thread")] async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/tests/rt_threaded.rs
521
568
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
tokio::task::block_in_place(|| {}); } #[tokio::test(flavor = "multi_thread")] async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/rt_threaded.rs
521
544
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime::{self, Runtime}; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin::Pin;...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
24f4ee31f0266a97547a81f510726da9c1bb9ec9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:14
tokio::task::block_in_place(|| {}); } #[tokio::test(flavor = "multi_thread")] async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
24f4ee31f0266a97547a81f510726da9c1bb9ec9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/tests/rt_threaded.rs
521
544
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime::{self, Runtime}; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin::Pin;...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:2
rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the pool to shutdown drop(rt); } } #[test] fn many_multisho...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
41
100
tokio-rs/tokio:tokio/tests/rt_threaded.rs:3
chain_rx = next_rx; } // This final task cycles if needed let (final_tx, final_rx) = tokio::sync::mpsc::channel(10); let cycle_tx = start_tx.clone(); let mut rem = CYCLES; rt.spawn(async move { for _ in 0..CYCLES { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
81
140
tokio-rs/tokio:tokio/tests/rt_threaded.rs:4
#[test] fn spawn_shutdown() { let rt = rt(); let (tx, rx) = mpsc::channel(); rt.block_on(async { tokio::spawn(client_server(tx.clone())); }); // Use spawner rt.spawn(client_server(tx)); assert_ok!(rx.recv()); assert_ok!(rx.recv()); drop(rt); assert_err!(rx.try_recv())...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
121
180
tokio-rs/tokio:tokio/tests/rt_threaded.rs:6
rt.spawn(Never(num_drop.clone())); // Wait for the pool to shutdown drop(rt); // Assert that only a single thread was spawned. let a = num_inc.load(Relaxed); assert!(a >= 1); // Assert that all threads shutdown let b = num_dec.load(Relaxed); assert_eq!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
201
260
tokio-rs/tokio:tokio/tests/rt_threaded.rs:7
let (tx, rx) = oneshot::channel(); rt.spawn(async move { assert_ok!(tx.send(())); }); assert_ok!(rt.block_on(rx)); drop(rt); assert!(after_start.load(Ordering::Relaxed) > 0); assert!(before_stop.load(Ordering::Relaxed) > 0); } #[test] fn blocking() { // used for notifying the ma...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
241
300
tokio-rs/tokio:tokio/tests/rt_threaded.rs:8
let cnt = cnt.clone(); let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
281
340
tokio-rs/tokio:tokio/tests/rt_threaded.rs:9
// When `block_in_place` returns, it attempts to reclaim the yielded runtime // worker. In this case, the remainder of the task is on the runtime worker and // must take part in the cooperative task budgeting system. // // The test ensures that, when this happens, attempting to consume from a // channel yields occasion...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
321
380
tokio-rs/tokio:tokio/tests/rt_threaded.rs:11
tokio::spawn(async { tokio::time::sleep(std::time::Duration::from_secs(2)).await; drop(sync_tx); }); tokio::time::sleep(std::time::Duration::from_secs(1)).await; } /// Demonstrates tokio-rs/tokio#3869 #[test] fn wake_during_shutdown() { struct Shared { waker: Option<Waker>, } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
401
460
tokio-rs/tokio:tokio/tests/rt_threaded.rs:12
let mut lock = me.shared.lock().unwrap(); println!("poll {}", me.put_waker); if me.put_waker { println!("putting"); lock.waker = Some(cx.waker().clone()); } Poll::Pending } } impl Drop for MyFuture { fn drop(&mut se...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
441
500
tokio-rs/tokio:tokio/tests/rt_threaded.rs:13
} #[tokio::test(flavor = "multi_thread")] async fn test_block_in_place2() { tokio::task::block_in_place(|| {}); } #[should_panic] #[tokio::main(flavor = "current_thread")] #[test] async fn test_block_in_place3() { tokio::task::block_in_place(|| {}); } #[tokio::main] #[test] async fn test_block_in_place4() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d39c9ed9dc29627ce3f2e134502ee24b4b537a04
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d39c9ed9dc29627ce3f2e134502ee24b4b537a04/tokio/tests/rt_threaded.rs
481
503
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime::{self, Runtime}; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin::Pin;...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:2
rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the pool to shutdown drop(rt); } } #[test] fn many_multishot...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
41
100
tokio-rs/tokio:tokio/tests/rt_threaded.rs:3
chain_rx = next_rx; } // This final task cycles if needed let (final_tx, final_rx) = tokio::sync::mpsc::channel(10); let cycle_tx = start_tx.clone(); let mut rem = CYCLES; rt.spawn(async move { for _ in 0..CYCLES { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
81
140
tokio-rs/tokio:tokio/tests/rt_threaded.rs:5
tx.send(()).unwrap(); } #[test] fn drop_threadpool_drops_futures() { for _ in 0..1_000 { let num_inc = Arc::new(AtomicUsize::new(0)); let num_dec = Arc::new(AtomicUsize::new(0)); let num_drop = Arc::new(AtomicUsize::new(0)); struct Never(Arc<AtomicUsize>); impl Future for ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
161
220
tokio-rs/tokio:tokio/tests/rt_threaded.rs:6
rt.spawn(Never(num_drop.clone())); // Wait for the pool to shutdown drop(rt); // Assert that only a single thread was spawned. let a = num_inc.load(Relaxed); assert!(a >= 1); // Assert that all threads shutdown let b = num_dec.load(Relaxed); assert_eq!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
201
260
tokio-rs/tokio:tokio/tests/rt_threaded.rs:7
rt.spawn(async move { assert_ok!(tx.send(())); }); assert_ok!(rt.block_on(rx)); drop(rt); assert!(after_start.load(Ordering::Relaxed) > 0); assert!(before_stop.load(Ordering::Relaxed) > 0); } #[test] fn blocking() { // used for notifying the main thread const NUM: usize = 1_000; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
241
300
tokio-rs/tokio:tokio/tests/rt_threaded.rs:8
let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the pool to shutdown block.wai...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
281
340
tokio-rs/tokio:tokio/tests/rt_threaded.rs:9
// When `block_in_place` returns, it attempts to reclaim the yielded runtime // worker. In this case, the remainder of the task is on the runtime worker and // must take part in the cooperative task budgeting system. // // The test ensures that, when this happens, attempting to consume from a // channel yields occasion...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
321
380
tokio-rs/tokio:tokio/tests/rt_threaded.rs:10
} { if v.is_none() { panic!("did not yield"); } } Poll::Ready(()) }) .await }) .await .unwrap(); }); } // Testing this does not panic #[test] fn max_blocking_threads() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
361
420
tokio-rs/tokio:tokio/tests/rt_threaded.rs:11
tokio::spawn(async { tokio::time::sleep(std::time::Duration::from_secs(2)).await; drop(sync_tx); }); tokio::time::sleep(std::time::Duration::from_secs(1)).await; } /// Demonstrates tokio-rs/tokio#3869 #[test] fn wake_during_shutdown() { struct Shared { waker: Option<Waker>, } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
401
460
tokio-rs/tokio:tokio/tests/rt_threaded.rs:12
println!("poll {}", me.put_waker); if me.put_waker { println!("putting"); lock.waker = Some(cx.waker().clone()); } Poll::Pending } } impl Drop for MyFuture { fn drop(&mut self) { println!("drop {} start", self.put_w...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
7601dc6d2a5c2902e78e220f44646960f910f38f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7601dc6d2a5c2902e78e220f44646960f910f38f/tokio/tests/rt_threaded.rs
441
478
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime::{self, Runtime}; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin::Pin;...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:10
} { if v.is_none() { panic!("did not yield"); } } Poll::Ready(()) }) .await }) .await .unwrap(); }); } // Testing this does not panic #[test] fn max_blocking_threads() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/tests/rt_threaded.rs
361
410
tokio-rs/tokio:tokio/tests/rt_threaded.rs:11
tokio::spawn(async { tokio::time::sleep(std::time::Duration::from_secs(2)).await; drop(sync_tx); }); tokio::time::sleep(std::time::Duration::from_secs(1)).await; } fn rt() -> Runtime { Runtime::new().unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/tests/rt_threaded.rs
401
410
tokio-rs/tokio:tokio/tests/rt_threaded.rs:8
let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the pool to shutdown block.wai...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
57dffb9dfe9e4c0f12429246540add3975f4a754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57dffb9dfe9e4c0f12429246540add3975f4a754/tokio/tests/rt_threaded.rs
281
340
tokio-rs/tokio:tokio/tests/rt_threaded.rs:9
// When `block_in_place` returns, it attempts to reclaim the yielded runtime // worker. In this case, the remainder of the task is on the runtime worker and // must take part in the cooperative task budgeting system. // // The test ensures that, when this happens, attempting to consume from a // channel yields occasion...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
57dffb9dfe9e4c0f12429246540add3975f4a754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57dffb9dfe9e4c0f12429246540add3975f4a754/tokio/tests/rt_threaded.rs
321
380
tokio-rs/tokio:tokio/tests/rt_threaded.rs:10
} { if v.is_none() { panic!("did not yield"); } } Poll::Ready(()) }) .await }) .await .unwrap(); }); } // Testing this does not panic #[test] fn max_threads() { let _...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
57dffb9dfe9e4c0f12429246540add3975f4a754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57dffb9dfe9e4c0f12429246540add3975f4a754/tokio/tests/rt_threaded.rs
361
401
tokio-rs/tokio:tokio/tests/rt_threaded.rs:10
} { if v.is_none() { panic!("did not yield"); } } Poll::Ready(()) }) .await }) .await .unwrap(); }); } // Testing this does not panic #[test] fn max_threads() { let _...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/rt_threaded.rs
361
387
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime::{self, Runtime}; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin::Pin;...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:2
let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the pool to shutdown drop(rt);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
41
100
tokio-rs/tokio:tokio/tests/rt_threaded.rs:5
assert_eq!(buf, b"hello"); tx.send(()).unwrap(); } #[test] fn drop_threadpool_drops_futures() { for _ in 0..1_000 { let num_inc = Arc::new(AtomicUsize::new(0)); let num_dec = Arc::new(AtomicUsize::new(0)); let num_drop = Arc::new(AtomicUsize::new(0)); struct Never(Arc<AtomicUsi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
161
220
tokio-rs/tokio:tokio/tests/rt_threaded.rs:6
.unwrap(); rt.spawn(Never(num_drop.clone())); // Wait for the pool to shutdown drop(rt); // Assert that only a single thread was spawned. let a = num_inc.load(Relaxed); assert!(a >= 1); // Assert that all threads shutdown let b = num_dec.load(Relaxed);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
201
260
tokio-rs/tokio:tokio/tests/rt_threaded.rs:7
.unwrap(); let (tx, rx) = oneshot::channel(); rt.spawn(async move { assert_ok!(tx.send(())); }); assert_ok!(rt.block_on(rx)); drop(rt); assert!(after_start.load(Ordering::Relaxed) > 0); assert!(before_stop.load(Ordering::Relaxed) > 0); } #[test] fn blocking() { // used for ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
241
300
tokio-rs/tokio:tokio/tests/rt_threaded.rs:8
for _ in 0..NUM { let cnt = cnt.clone(); let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
281
340
tokio-rs/tokio:tokio/tests/rt_threaded.rs:9
done_rx.recv().unwrap(); } // When `block_in_place` returns, it attempts to reclaim the yielded runtime // worker. In this case, the remainder of the task is on the runtime worker and // must take part in the cooperative task budgeting system. // // The test ensures that, when this happens, attempting to consume from ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
321
380
tokio-rs/tokio:tokio/tests/rt_threaded.rs:10
let fut = rx.recv(); } Pin::new(&mut fut).poll(cx) } { if v.is_none() { panic!("did not yield"); } } Poll::Ready(()) }) .await }) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
066965cd59d01fd9d999152e32169a24dfe434fa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/rt_threaded.rs
361
392
tokio-rs/tokio:tokio/tests/rt_threaded.rs:4
#[test] fn spawn_shutdown() { let rt = rt(); let (tx, rx) = mpsc::channel(); rt.block_on(async { tokio::spawn(client_server(tx.clone())); }); // Use spawner rt.spawn(client_server(tx)); assert_ok!(rx.recv()); assert_ok!(rx.recv()); drop(rt); assert_err!(rx.try_recv())...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/tests/rt_threaded.rs
121
180
tokio-rs/tokio:tokio/tests/rt_threaded.rs:2
let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the pool to shutdown drop(rt);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/rt_threaded.rs
41
100
tokio-rs/tokio:tokio/tests/rt_threaded.rs:3
chain_rx = next_rx; } // This final task cycles if needed let (mut final_tx, final_rx) = tokio::sync::mpsc::channel(10); let mut cycle_tx = start_tx.clone(); let mut rem = CYCLES; rt.spawn(async move { for _ in 0..CYCLES { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/rt_threaded.rs
81
140
tokio-rs/tokio:tokio/tests/rt_threaded.rs:9
done_rx.recv().unwrap(); } // When `block_in_place` returns, it attempts to reclaim the yielded runtime // worker. In this case, the remainder of the task is on the runtime worker and // must take part in the cooperative task budgeting system. // // The test ensures that, when this happens, attempting to consume from ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/rt_threaded.rs
321
380
tokio-rs/tokio:tokio/tests/rt_threaded.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime::{self, Runtime}; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use futures::future::poll_fn; use std::future::Future; use std::pin::Pin;...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
bff21aba6c1568f260fdf48d2eb3c0566e293f5a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bff21aba6c1568f260fdf48d2eb3c0566e293f5a/tokio/tests/rt_threaded.rs
1
60
tokio-rs/tokio:tokio/tests/rt_threaded.rs:2
let tx = tx.clone(); rt.spawn(async move { let num = cnt.fetch_add(1, Relaxed) + 1; if num == NUM { tx.send(()).unwrap(); } }); } rx.recv().unwrap(); // Wait for the pool to shutdown drop(rt);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
bff21aba6c1568f260fdf48d2eb3c0566e293f5a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bff21aba6c1568f260fdf48d2eb3c0566e293f5a/tokio/tests/rt_threaded.rs
41
100
tokio-rs/tokio:tokio/tests/rt_threaded.rs:3
} }); chain_rx = next_rx; } // This final task cycles if needed let (mut final_tx, final_rx) = mpsc::channel(10); let mut cycle_tx = start_tx.clone(); let mut rem = CYCLES; rt.spawn(async move { fo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_threaded.rs
MIT
bff21aba6c1568f260fdf48d2eb3c0566e293f5a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bff21aba6c1568f260fdf48d2eb3c0566e293f5a/tokio/tests/rt_threaded.rs
81
140