mirror of https://github.com/fafhrd91/actix-net
Migrate actix-rt to std::future (#47)
This commit is contained in:
parent
05ae2585f3
commit
eba19a2da3
|
@ -284,7 +284,7 @@ impl Future for ArbiterController {
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
loop {
|
loop {
|
||||||
match unsafe { self.as_mut().map_unchecked_mut(|p| &mut p.rx) }.poll_next(cx) {
|
match Pin::new(&mut self.rx).poll_next(cx) {
|
||||||
Poll::Ready(None) => {
|
Poll::Ready(None) => {
|
||||||
return Poll::Ready(())
|
return Poll::Ready(())
|
||||||
},
|
},
|
||||||
|
@ -341,7 +341,7 @@ impl Future for SystemArbiter {
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
loop {
|
loop {
|
||||||
match unsafe { self.as_mut().map_unchecked_mut(|p| &mut p.commands) }.poll_next(cx) {
|
match Pin::new(&mut self.commands).poll_next(cx) {
|
||||||
Poll::Ready(None) => return Poll::Ready(()),
|
Poll::Ready(None) => return Poll::Ready(()),
|
||||||
Poll::Ready(Some(cmd)) => match cmd {
|
Poll::Ready(Some(cmd)) => match cmd {
|
||||||
SystemCommand::Exit(code) => {
|
SystemCommand::Exit(code) => {
|
||||||
|
|
|
@ -149,11 +149,12 @@ impl Runtime {
|
||||||
|
|
||||||
// WARN: We do not enter the executor here, since in tokio 0.2 the executor is entered
|
// WARN: We do not enter the executor here, since in tokio 0.2 the executor is entered
|
||||||
// automatically inside its `block_on` and `run` methods
|
// automatically inside its `block_on` and `run` methods
|
||||||
let _reactor_guard = tokio_net::driver::set_default(reactor_handle);
|
tokio_executor::with_default(&mut current_thread::TaskExecutor::current(),|| {
|
||||||
let _timer_guard = tokio_timer::set_default(timer_handle);
|
tokio_timer::clock::with_default(clock, || {
|
||||||
|
let _reactor_guard = tokio_net::driver::set_default(reactor_handle);
|
||||||
tokio_timer::clock::with_default(clock , || {
|
let _timer_guard = tokio_timer::set_default(timer_handle);
|
||||||
f(executor)
|
f(executor)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue