runtime: create reactor per worker (#660)

This commit is contained in:
Stjepan Glavina
2018-10-02 18:19:27 -07:00
committed by Carl Lerche
parent 886511c0a6
commit d35d0518f5
6 changed files with 60 additions and 52 deletions
+3 -13
View File
@@ -1,4 +1,5 @@
use runtime::Inner;
use tokio_threadpool as threadpool;
use std::fmt;
@@ -6,23 +7,12 @@ use futures::{Future, Poll};
/// A future that resolves when the Tokio `Runtime` is shut down.
pub struct Shutdown {
pub(super) inner: Box<Future<Item = (), Error = ()> + Send>,
pub(super) inner: threadpool::Shutdown,
}
impl Shutdown {
pub(super) fn shutdown_now(inner: Inner) -> Self {
let inner = Box::new({
let pool = inner.pool;
let reactor = inner.reactor;
pool.shutdown_now().and_then(|_| {
reactor.shutdown_now()
.then(|_| {
Ok(())
})
})
});
let inner = inner.pool.shutdown_now();
Shutdown { inner }
}
}