executor: block thread when needed in block fn (#1303)

Fix #1296
This commit is contained in:
matthieugras
2019-07-15 08:56:20 -07:00
committed by Carl Lerche
parent 5fbb36a060
commit 0b75c0c53d
+2 -1
View File
@@ -70,7 +70,7 @@ impl Enter {
use std::task::Context;
use std::task::Poll::Ready;
let park = ParkThread::new();
let mut park = ParkThread::new();
let waker = park.unpark().into_waker();
let mut cx = Context::from_waker(&waker);
@@ -82,6 +82,7 @@ impl Enter {
if let Ready(v) = f.as_mut().poll(&mut cx) {
return v;
}
park.park().unwrap();
}
}
}