rt: allow block_on inside block_in_place inside block_on (#2645)

A fast path in block_on_place was failing to call exit() in the case where we
were in a block_on call.

Fixes: #2639

Co-authored-by: Bryan Donlan <[email protected]>
This commit is contained in:
bdonlan
2020-07-14 21:31:13 -07:00
committed by GitHub
co-authored by Bryan Donlan
parent b9e3d2edde
commit fc63fa2606
2 changed files with 24 additions and 1 deletions
+19
View File
@@ -96,3 +96,22 @@ fn no_block_in_basic_block_on() {
task::block_in_place(|| {});
});
}
#[test]
fn can_enter_basic_rt_from_within_block_in_place() {
let mut outer = tokio::runtime::Builder::new()
.threaded_scheduler()
.build()
.unwrap();
outer.block_on(async {
tokio::task::block_in_place(|| {
let mut inner = tokio::runtime::Builder::new()
.basic_scheduler()
.build()
.unwrap();
inner.block_on(async {})
})
});
}