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_unstable_metrics.rs:15 | for i in 0..10 {
assert_eq!(i, metrics.injection_queue_depth());
rt.spawn(async {});
}
barrier2.wait();
}
#[test]
fn worker_local_queue_depth() {
const N: usize = 100;
let rt = current_thread();
let metrics = rt.metrics();
rt.block_on(async {
for _ in 0..N {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_unstable_metrics.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/tests/rt_unstable_metrics.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/rt_unstable_metrics.rs:18 | if fut.poll(cx).is_pending() {
did_yield_2 = true;
return Poll::Pending;
}
})
)
});
assert_eq!(1, rt.metrics().budget_forced_yield_count());
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
#[test]
fn io_driver_fd_count() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_unstable_metrics.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/tests/rt_unstable_metrics.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/rt_unstable_metrics.rs:19 | assert_eq!(metrics.io_driver_ready_count(), 1);
}
fn current_thread() -> Runtime {
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
}
fn threaded() -> Runtime {
tokio::runtime::Builder::new_multi_thread()
.worker_threads(2)
.enable_all()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_unstable_metrics.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/tests/rt_unstable_metrics.rs | 721 | 751 |
tokio-rs/tokio:tokio/tests/rt_worker_index.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", tokio_unstable, not(target_os = "wasi"),))]
use tokio::runtime::{self, Runtime};
#[test]
fn worker_index_current_thread() {
let rt = runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();
rt.block_on(async {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_worker_index.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_worker_index.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/rt_worker_index.rs:2 | rt.block_on(async {
// Spawn a task and verify the worker_index matches the metrics index
tokio::task::spawn(async move {
let index = runtime::worker_index().expect("should be on worker thread");
let current_thread = std::thread::current().id();
let metrics_thread = m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_worker_index.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_worker_index.rs | 41 | 83 |
tokio-rs/tokio:tokio/tests/runtime.rs:1 | #![cfg(feature = "broken")]
#![deny(warnings, rust_2018_idioms)]
use env_logger;
use futures;
use futures::sync::oneshot;
use std::sync::{atomic, Arc, Mutex};
use std::thread;
use tokio;
use tokio::io;
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::future::lazy;
use tokio::prelude::*;
use tokio::runtime... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime.rs:2 | io::write_all(socket, b"hello")
.map(|_| ())
.map_err(|e| panic!("write err = {:?}", e))
})
})
.map(|_| ());
let client = client
.map_err(|e| panic!("connect err = {:?}", e))
.and_then(|client| {
// Read all
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime.rs:3 | tokio::runtime::current_thread::block_on_all(create_client_server_future()).unwrap();
}
mod runtime_single_threaded_block_on_all {
use super::*;
fn test<F>(spawn: F)
where
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>),
{
let cnt = Arc::new(Mutex::new(0));
let c = cnt.clo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime.rs:4 | })
}
#[test]
fn execute() {
test(|f| {
tokio::executor::DefaultExecutor::current()
.execute(f)
.unwrap();
})
}
}
mod runtime_single_threaded_racy {
use super::*;
fn test<F>(spawn: F)
where
F: Fn(
tokio::runtime... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime.rs:5 | Box::new(futures::future::lazy(move || {
tx.send(()).unwrap();
Ok(())
})),
);
// signal runtime thread to exit
trigger.send(()).unwrap();
// wait for runtime thread to exit
jh.join().unwrap();
assert_eq!(rx.wait().unwrap(), (... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/runtime.rs:6 | runtime.shutdown_on_idle().wait().unwrap();
}
#[test]
fn spawn() {
test(|rt| {
rt.spawn(create_client_server_future());
});
}
#[test]
fn execute() {
test(|rt| {
rt.executor()
.execute(create_client_server_future())
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/runtime.rs:7 | fn test<F>(spawn: F)
where
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>) + Send + 'static,
{
let cnt = Arc::new(Mutex::new(0));
let c = cnt.clone();
let runtime = Runtime::new().unwrap();
let msg = runtime
.block_on(lazy(move || {
{
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/runtime.rs:8 | }
#[test]
fn spawn() {
test(|f| {
tokio::spawn(f);
})
}
}
#[test]
fn block_waits() {
let (tx, rx) = oneshot::channel();
thread::spawn(|| {
use std::time::Duration;
thread::sleep(Duration::from_millis(1000));
tx.send(()).unwrap();
});
le... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/runtime.rs:9 | const ITER: usize = 200;
fn test<F>(spawn: F)
where
F: Fn(&mut Runtime, Box<dyn Future<Item = (), Error = ()> + Send>),
{
let cnt = Arc::new(Mutex::new(0));
let mut runtime = Runtime::new().unwrap();
for _ in 0..ITER {
let c = cnt.clone();
spawn(
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/runtime.rs:10 | }
mod from_block_on_all {
use super::*;
fn test<F>(spawn: F)
where
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>) + Send + 'static,
{
let cnt = Arc::new(Mutex::new(0));
let c = cnt.clone();
let runtime = Runtime::new().unwrap();
let msg = runtime
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/runtime.rs:11 | tokio::executor::DefaultExecutor::current()
.execute(f)
.unwrap();
})
}
#[test]
fn spawn() {
test(|f| {
tokio::spawn(f);
})
}
}
mod nested_enter {
use super::*;
use std::panic;
use tokio::runtime::current_thread;
fn t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/runtime.rs:12 | }
}));
first(Box::new(lazy(move || {
panic::catch_unwind(move || nested(Box::new(lazy(|| Ok::<(), ()>(())))))
.expect_err("nested should panic");
*panicked2.lock().unwrap() = true;
Ok::<(), ()>(())
})));
panic::set_hook(prev_hook);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/runtime.rs:13 | });
}
#[test]
fn current_thread_block_on_all_in_run() {
test(tokio::run, |fut| {
current_thread::block_on_all(fut).unwrap();
});
}
}
#[test]
fn runtime_reactor_handle() {
#![allow(deprecated)]
use futures::Stream;
use std::net::{TcpListener as StdListener, TcpS... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 481 | 537 |
tokio-rs/tokio:tokio/tests/runtime.rs:14 | let after_inner = after_start.clone();
let before_inner = before_stop.clone();
let runtime = tokio::runtime::Builder::new()
.after_start(move || {
after_inner.clone().fetch_add(1, atomic::Ordering::Relaxed);
})
.before_stop(move || {
before_inner.clone().fetch_add... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/runtime.rs | 521 | 537 |
tokio-rs/tokio:tokio/tests/runtime.rs:1 | #![deny(warnings, rust_2018_idioms)]
use env_logger;
use futures;
use futures::sync::oneshot;
use std::sync::{atomic, Arc, Mutex};
use std::thread;
use tokio;
use tokio::io;
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::future::lazy;
use tokio::prelude::*;
use tokio::runtime::Runtime;
// this import i... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime.rs:2 | .map(|_| ())
.map_err(|e| panic!("write err = {:?}", e))
})
})
.map(|_| ());
let client = client
.map_err(|e| panic!("connect err = {:?}", e))
.and_then(|client| {
// Read all
io::read_to_end(client, vec![])
.ma... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime.rs:3 | }
mod runtime_single_threaded_block_on_all {
use super::*;
fn test<F>(spawn: F)
where
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>),
{
let cnt = Arc::new(Mutex::new(0));
let c = cnt.clone();
let msg = tokio::runtime::current_thread::block_on_all(lazy(move || {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime.rs:4 | }
#[test]
fn execute() {
test(|f| {
tokio::executor::DefaultExecutor::current()
.execute(f)
.unwrap();
})
}
}
mod runtime_single_threaded_racy {
use super::*;
fn test<F>(spawn: F)
where
F: Fn(
tokio::runtime::curre... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime.rs:5 | tx.send(()).unwrap();
Ok(())
})),
);
// signal runtime thread to exit
trigger.send(()).unwrap();
// wait for runtime thread to exit
jh.join().unwrap();
assert_eq!(rx.wait().unwrap(), ());
}
#[test]
fn spawn() {
test(|han... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/runtime.rs:6 | }
#[test]
fn spawn() {
test(|rt| {
rt.spawn(create_client_server_future());
});
}
#[test]
fn execute() {
test(|rt| {
rt.executor()
.execute(create_client_server_future())
.unwrap();
});
}
}
#[test]
fn bloc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/runtime.rs:7 | where
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>) + Send + 'static,
{
let cnt = Arc::new(Mutex::new(0));
let c = cnt.clone();
let runtime = Runtime::new().unwrap();
let msg = runtime
.block_on(lazy(move || {
{
let mut ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/runtime.rs:8 | #[test]
fn spawn() {
test(|f| {
tokio::spawn(f);
})
}
}
#[test]
fn block_waits() {
let (tx, rx) = oneshot::channel();
thread::spawn(|| {
use std::time::Duration;
thread::sleep(Duration::from_millis(1000));
tx.send(()).unwrap();
});
let cnt =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/runtime.rs:9 | const ITER: usize = 200;
fn test<F>(spawn: F)
where
F: Fn(&mut Runtime, Box<dyn Future<Item = (), Error = ()> + Send>),
{
let cnt = Arc::new(Mutex::new(0));
let mut runtime = Runtime::new().unwrap();
for _ in 0..ITER {
let c = cnt.clone();
spawn(
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/runtime.rs:10 | mod from_block_on_all {
use super::*;
fn test<F>(spawn: F)
where
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>) + Send + 'static,
{
let cnt = Arc::new(Mutex::new(0));
let c = cnt.clone();
let runtime = Runtime::new().unwrap();
let msg = runtime
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/runtime.rs:11 | .execute(f)
.unwrap();
})
}
#[test]
fn spawn() {
test(|f| {
tokio::spawn(f);
})
}
}
mod nested_enter {
use super::*;
use std::panic;
use tokio::runtime::current_thread;
fn test<F1, F2>(first: F1, nested: F2)
where
F1: Fn(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/runtime.rs:12 | }));
first(Box::new(lazy(move || {
panic::catch_unwind(move || nested(Box::new(lazy(|| Ok::<(), ()>(())))))
.expect_err("nested should panic");
*panicked2.lock().unwrap() = true;
Ok::<(), ()>(())
})));
panic::set_hook(prev_hook);
ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/runtime.rs:13 | }
#[test]
fn current_thread_block_on_all_in_run() {
test(tokio::run, |fut| {
current_thread::block_on_all(fut).unwrap();
});
}
}
#[test]
fn runtime_reactor_handle() {
#![allow(deprecated)]
use futures::Stream;
use std::net::{TcpListener as StdListener, TcpStream as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 481 | 536 |
tokio-rs/tokio:tokio/tests/runtime.rs:14 | let before_inner = before_stop.clone();
let runtime = tokio::runtime::Builder::new()
.after_start(move || {
after_inner.clone().fetch_add(1, atomic::Ordering::Relaxed);
})
.before_stop(move || {
before_inner.clone().fetch_add(1, atomic::Ordering::Relaxed);
})
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/tests/runtime.rs | 521 | 536 |
tokio-rs/tokio:tokio/tests/runtime.rs:6 | }
#[test]
fn spawn() {
test(|rt| {
rt.spawn(create_client_server_future());
});
}
#[test]
fn execute() {
test(|rt| {
rt.executor()
.execute(create_client_server_future())
.unwrap();
});
}
}
#[test]
fn bloc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/runtime.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/runtime.rs:7 | where
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>) + Send + 'static,
{
let cnt = Arc::new(Mutex::new(0));
let c = cnt.clone();
let mut runtime = Runtime::new().unwrap();
let msg = runtime
.block_on(lazy(move || {
{
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/runtime.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/runtime.rs:8 | #[test]
fn spawn() {
test(|f| {
tokio::spawn(f);
})
}
}
#[test]
fn block_waits() {
let (tx, rx) = oneshot::channel();
thread::spawn(|| {
use std::time::Duration;
thread::sleep(Duration::from_millis(1000));
tx.send(()).unwrap();
});
let cnt =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/runtime.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/runtime.rs:12 | }));
first(Box::new(lazy(move || {
panic::catch_unwind(move || nested(Box::new(lazy(|| Ok::<(), ()>(())))))
.expect_err("nested should panic");
*panicked2.lock().unwrap() = true;
Ok::<(), ()>(())
})));
panic::set_hook(prev_hook);
ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/runtime.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:1 | #![warn(rust_2018_idioms)]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::current_thread::Runtime;
use tokio::sync::oneshot;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::mpsc;
use std::time::{Duration, Instant};
use tokio::timer::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_current_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:2 | let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
delay(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.spawn(client_server(tx));
rt.run().unwrap();
assert_ok!(rx.try_recv())... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_current_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:3 | fn block_on() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
delay(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.block_on(client_server... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_current_thread.rs | 81 | 137 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:4 | let handle = handle_rx.recv().unwrap();
handle
.spawn(async {
tx.send(()).unwrap();
})
.unwrap();
// signal runtime thread to exit
trigger.send(()).unwrap();
// wait for runtime thread to exit
jh.join().unwrap();
let mut e = tokio::executor::enter().unwrap(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_current_thread.rs | 121 | 137 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::current_thread::Runtime;
use tokio::sync::oneshot;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::mpsc;
use std::time::{Duration,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_current_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:2 | let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
delay(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.spawn(client_server(tx));
rt.run().unw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_current_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:3 | #[test]
fn block_on() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
delay(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.block_on(clien... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_current_thread.rs | 81 | 138 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:4 | let (tx, rx) = oneshot::channel();
let handle = handle_rx.recv().unwrap();
handle
.spawn(async {
tx.send(()).unwrap();
})
.unwrap();
// signal runtime thread to exit
trigger.send(()).unwrap();
// wait for runtime thread to exit
jh.join().unwrap();
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_current_thread.rs | 121 | 138 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::current_thread::Runtime;
use tokio::sync::oneshot;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::mpsc;
use std::time::{Duration,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_current_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:2 | fn spawn_run_spawn_root() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
delay(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.spawn(clie... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_current_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:1 | #![warn(rust_2018_idioms)]
#![feature(async_await)]
#![cfg(feature = "default")]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::current_thread::Runtime;
use tokio::sync::oneshot;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::mpsc;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_current_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:2 | #[test]
fn spawn_run_spawn_root() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
delay(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.sp... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_current_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:3 | }
#[test]
fn block_on() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
delay(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.block_on(cl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_current_thread.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:4 | });
let (tx, rx) = oneshot::channel();
let handle = handle_rx.recv().unwrap();
handle
.spawn(async {
tx.send(()).unwrap();
})
.unwrap();
// signal runtime thread to exit
trigger.send(()).unwrap();
// wait for runtime thread to exit
jh.join().unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_current_thread.rs | 121 | 140 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:1 | #![warn(rust_2018_idioms)]
#![feature(async_await)]
#![cfg(feature = "default")]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::current_thread::Runtime;
use tokio::sync::oneshot;
use tokio::timer::Delay;
use tokio_test::{assert_err, assert_ok};
use env_logg... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_current_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:2 | #[test]
fn spawn_run_spawn_root() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
Delay::new(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_current_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:3 | }
#[test]
fn block_on() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
Delay::new(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.block_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_current_thread.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:1 | #![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
#![cfg(feature = "default")]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::current_thread::Runtime;
use tokio::sync::oneshot;
use tokio::timer::Delay;
use tokio_test::{assert_err, assert_ok};
us... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | 962521f449dead58eb37eb46857bc6c52ee3a8da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/962521f449dead58eb37eb46857bc6c52ee3a8da/tokio/tests/runtime_current_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:1 | #![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::current_thread::Runtime;
use tokio::sync::oneshot;
use tokio::timer::Delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/tests/runtime_current_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:2 | fn spawn_run_spawn_root() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
Delay::new(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.spawn... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/tests/runtime_current_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_current_thread.rs:3 | #[test]
fn block_on() {
let _ = env_logger::try_init();
let mut rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
rt.spawn(async move {
Delay::new(Instant::now() + Duration::from_millis(1000)).await;
tx2.send(()).unwrap();
});
rt.block_on(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_current_thread.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/tests/runtime_current_thread.rs | 81 | 139 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![warn(rust_2018_idioms)]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::delay;
use tokio_test::{assert_err, assert_ok};
use std::sync::{mpsc, Arc, Mutex};
use std::thread;
use std::time::{Duration, Inst... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use spawner
rt.spawner().spawn(client_server(tx));
assert_ok!(rx.recv());
assert_ok!(rx.recv());
rt.shutdown_now();
assert_err!(rx.try_recv());
}
#[test]
fn block_on_timer() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | tx.send(()).unwrap();
});
TcpStream::connect(&addr).await.unwrap();
rx.await.unwrap();
});
}
#[test]
fn block_waits() {
let (a_tx, a_rx) = oneshot::channel();
let (b_tx, b_rx) = mpsc::channel();
thread::spawn(|| {
use std::time::Duration;
thread::sleep(Duratio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | rt.block_on(async move {
for _ in 0..ITER {
let c = c.clone();
let tx = tx.clone();
tokio::spawn(async move {
let mut x = c.lock().unwrap();
*x = 1 + *x;
if *x == ITER {
tx.lock().unwrap().send(()).unwrap();... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | let _ = env_logger::try_init();
let after_start = Arc::new(AtomicUsize::new(0));
let before_stop = Arc::new(AtomicUsize::new(0));
let after_inner = after_start.clone();
let before_inner = before_stop.clone();
let rt = tokio::runtime::Builder::new()
.after_start(move || {
after_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/runtime_threaded.rs | 161 | 188 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::{mpsc, Arc,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | #[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use spawner
rt.spawner().spawn(client_server(tx));
assert_ok!(rx.recv());
assert_ok!(rx.recv());
rt.shutdown_no... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | tokio::spawn(async move {
let _ = listener.accept().await;
tx.send(()).unwrap();
});
TcpStream::connect(&addr).await.unwrap();
rx.await.unwrap();
});
}
#[test]
fn block_waits() {
let (a_tx, a_rx) = oneshot::channel();
let (b_tx, b_rx) = mpsc::channel();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | let tx = Arc::new(Mutex::new(tx));
let c = cnt.clone();
rt.block_on(async move {
for _ in 0..ITER {
let c = c.clone();
let tx = tx.clone();
tokio::spawn(async move {
let mut x = c.lock().unwrap();
*x = 1 + *x;
if *x ==... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | fn after_start_and_before_stop_is_called() {
use std::sync::atomic::{AtomicUsize, Ordering};
let _ = env_logger::try_init();
let after_start = Arc::new(AtomicUsize::new(0));
let before_stop = Arc::new(AtomicUsize::new(0));
let after_inner = after_start.clone();
let before_inner = before_stop.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/tests/runtime_threaded.rs | 161 | 191 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::{mpsc, Arc,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | #[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use executor trait
let f = Box::pin(client_server(tx));
tokio_executor::Executor::spawn(&mut rt.executor(), f).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | let mut listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
let addr = listener.local_addr().unwrap();
tokio::spawn(async move {
let _ = listener.accept().await;
tx.send(()).unwrap();
});
TcpStream::connect(&addr).await.unwrap();
rx.await.unwrap(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | let cnt = Arc::new(Mutex::new(0));
let rt = Runtime::new().unwrap();
let c = cnt.clone();
rt.block_on(async move {
for _ in 0..ITER {
let c = c.clone();
tokio::spawn(async move {
let mut x = c.lock().unwrap();
*x = 1 + *x;
});
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | println!("{}", s);
}
}));
let res = panic::catch_unwind(move || {
let rt = Runtime::new().unwrap();
rt.block_on(async {});
});
assert_err!(res);
panic::set_hook(prev_hook);
});
}
#[test]
fn after_start_and_before_stop_is_called() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/runtime_threaded.rs | 161 | 207 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::{mpsc, Arc,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | #[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use executor trait
let f = Box::pin(client_server(tx));
tokio_executor::Executor::spawn(&mut rt.executor(), f).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | let addr = "127.0.0.1:0".parse().unwrap();
let (tx, rx) = oneshot::channel();
let mut listener = TcpListener::bind(&addr).unwrap();
let addr = listener.local_addr().unwrap();
tokio::spawn(async move {
let _ = listener.accept().await;
tx.send(()).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | #[test]
fn spawn_many() {
const ITER: usize = 200;
let cnt = Arc::new(Mutex::new(0));
let rt = Runtime::new().unwrap();
let c = cnt.clone();
rt.block_on(async move {
for _ in 0..ITER {
let c = c.clone();
tokio::spawn(async move {
let mut x = c.lock()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | {
// expected, noop
} else {
println!("{}", s);
}
}));
let res = panic::catch_unwind(move || {
let rt = Runtime::new().unwrap();
rt.block_on(async {});
});
assert_err!(res);
panic::set_hook(prev_ho... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_threaded.rs | 161 | 210 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:6 | rt.block_on(client_server(tx));
rt.shutdown_on_idle();
assert_ok!(rx.try_recv());
assert!(after_start.load(Ordering::Relaxed) > 0);
assert!(before_stop.load(Ordering::Relaxed) > 0);
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/runtime_threaded.rs | 201 | 210 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![warn(rust_2018_idioms)]
#![feature(async_await)]
#![cfg(feature = "default")]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | }
#[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use executor trait
let f = Box::pin(client_server(tx));
tokio_executor::Executor::spawn(&mut rt.executor(), f).unwrap(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | rt.block_on(async move {
let addr = "127.0.0.1:0".parse().unwrap();
let (tx, rx) = oneshot::channel();
let mut listener = TcpListener::bind(&addr).unwrap();
let addr = listener.local_addr().unwrap();
tokio::spawn(async move {
let _ = listener.accept().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | #[test]
fn spawn_many() {
const ITER: usize = 200;
let cnt = Arc::new(Mutex::new(0));
let rt = Runtime::new().unwrap();
let c = cnt.clone();
rt.block_on(async move {
for _ in 0..ITER {
let c = c.clone();
tokio::spawn(async move {
let mut x = c.lock()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | || s.starts_with("panicked at 'Multiple executors at once")
{
// expected, noop
} else {
println!("{}", s);
}
}));
let res = panic::catch_unwind(move || {
let rt = Runtime::new().unwrap();
rt.block_on(async {});... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_threaded.rs | 161 | 211 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:6 | let (tx, rx) = mpsc::channel();
rt.block_on(client_server(tx));
rt.shutdown_on_idle();
assert_ok!(rx.try_recv());
assert!(after_start.load(Ordering::Relaxed) > 0);
assert!(before_stop.load(Ordering::Relaxed) > 0);
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 2d56312b89ba407272b161290d563551efc896a6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2d56312b89ba407272b161290d563551efc896a6/tokio/tests/runtime_threaded.rs | 201 | 211 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![warn(rust_2018_idioms)]
#![feature(async_await)]
#![cfg(feature = "default")]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::Delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | }
#[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use executor trait
let f = Box::pin(client_server(tx));
tokio_executor::Executor::spawn(&mut rt.executor(), f).unwrap(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | rt.block_on(async move {
let addr = "127.0.0.1:0".parse().unwrap();
let (tx, rx) = oneshot::channel();
let mut listener = TcpListener::bind(&addr).unwrap();
let addr = listener.local_addr().unwrap();
tokio::spawn(async move {
let _ = listener.accept().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | }
#[test]
fn spawn_many() {
const ITER: usize = 200;
let cnt = Arc::new(Mutex::new(0));
let rt = Runtime::new().unwrap();
let c = cnt.clone();
rt.block_on(async move {
for _ in 0..ITER {
let c = c.clone();
tokio::spawn(async move {
let mut x = c.loc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | if s.starts_with("panicked at 'nested ")
|| s.starts_with("panicked at 'Multiple executors at once")
{
// expected, noop
} else {
println!("{}", s);
}
}));
let res = panic::catch_unwind(move || {
let rt = Ru... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/runtime_threaded.rs | 161 | 212 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
#![cfg(feature = "default")]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::Delay;
use tokio_test::{assert_err, assert_ok};
use env... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 962521f449dead58eb37eb46857bc6c52ee3a8da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/962521f449dead58eb37eb46857bc6c52ee3a8da/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::Delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::{mpsc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 47e2ff48d9f1daac7dba9f136b24eed64c87cf40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47e2ff48d9f1daac7dba9f136b24eed64c87cf40/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | #[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use executor trait
let f = Box::pin(client_server(tx));
tokio_executor::Executor::spawn(&mut rt.executor(), f).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 47e2ff48d9f1daac7dba9f136b24eed64c87cf40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47e2ff48d9f1daac7dba9f136b24eed64c87cf40/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:1 | #![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
use tokio;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::timer::Delay;
use tokio_test::{assert_err, assert_ok};
use env_logger;
use std::sync::{mpsc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/tests/runtime_threaded.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | #[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use executor trait
let f = Box::pin(client_server(tx));
tokio_executor::Executor::spawn(&mut rt.executor(), f).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/tests/runtime_threaded.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | let rt = Runtime::new().unwrap();
rt.block_on(async move {
let addr = "127.0.0.1:0".parse().unwrap();
let (tx, rx) = oneshot::channel();
let mut listener = TcpListener::bind(&addr).unwrap();
let addr = listener.local_addr().unwrap();
tokio::spawn(async move {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | let mut e = tokio_executor::enter().unwrap();
e.block_on(rt.shutdown_on_idle());
}
#[test]
fn spawn_many() {
const ITER: usize = 200;
let cnt = Arc::new(Mutex::new(0));
let rt = Runtime::new().unwrap();
let c = cnt.clone();
rt.block_on(async move {
for _ in 0..ITER {
let c... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | let prev_hook = panic::take_hook();
panic::set_hook(Box::new(|info| {
let s = info.to_string();
if s.starts_with("panicked at 'nested ")
|| s.starts_with("panicked at 'Multiple executors at once")
{
// expected, noop
} else {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/tests/runtime_threaded.rs | 161 | 216 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:6 | })
.build()
.unwrap();
let (tx, rx) = mpsc::channel();
rt.block_on(client_server(tx));
let mut e = tokio_executor::enter().unwrap();
e.block_on(rt.shutdown_on_idle());
assert_ok!(rx.try_recv());
assert!(after_start.load(Ordering::Relaxed) > 0);
assert!(before_stop.load(O... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/tests/runtime_threaded.rs | 201 | 216 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:2 | #[test]
fn spawn_shutdown() {
let _ = env_logger::try_init();
let rt = Runtime::new().unwrap();
let (tx, rx) = mpsc::channel();
rt.spawn(client_server(tx.clone()));
// Use executor trait
let f = Box::pin(client_server(tx));
tokio_executor::Executor::spawn(&mut rt.executor(), f).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/tests/runtime_threaded.rs | 41 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.