summaryrefslogtreecommitdiffstats
path: root/tokio/tests/signal_multi_rt.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-11-01 13:18:52 -0700
committerGitHub <noreply@github.com>2019-11-01 13:18:52 -0700
commitd70c928d88dff9e3e8d673b8ee02bce131598550 (patch)
tree6b079db2f80bd61764203a32ffe48769d18c1386 /tokio/tests/signal_multi_rt.rs
parent742d89b0f333150f6a550ae7840235851f4eb069 (diff)
runtime: merge multi & single threaded runtimes (#1716)
Simplify Tokio's runtime construct by combining both Runtime variants into a single type. The execution style can be controlled by a configuration setting on `Builder`. The implication of this change is that there is no longer any way to spawn `!Send` futures. This, however, is a temporary limitation. A different strategy will be employed for supporting `!Send` futures. Included in this patch is a rework of `task::JoinHandle` to support using this type from both the thread-pool and current-thread executors.
Diffstat (limited to 'tokio/tests/signal_multi_rt.rs')
-rw-r--r--tokio/tests/signal_multi_rt.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/tokio/tests/signal_multi_rt.rs b/tokio/tests/signal_multi_rt.rs
index 9ecf70ed..6a16dd88 100644
--- a/tokio/tests/signal_multi_rt.rs
+++ b/tokio/tests/signal_multi_rt.rs
@@ -7,7 +7,7 @@ mod support {
use support::signal::send_signal;
use tokio::prelude::*;
-use tokio::runtime::current_thread::Runtime;
+use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
use std::sync::mpsc::channel;
@@ -24,7 +24,7 @@ fn multi_loop() {
.map(|_| {
let sender = sender.clone();
thread::spawn(move || {
- let mut rt = Runtime::new().unwrap();
+ let mut rt = rt();
let _ = rt.block_on(async {
let signal = signal(SignalKind::hangup()).unwrap();
sender.send(()).unwrap();
@@ -45,3 +45,10 @@ fn multi_loop() {
}
}
}
+
+fn rt() -> Runtime {
+ tokio::runtime::Builder::new()
+ .current_thread()
+ .build()
+ .unwrap()
+}