mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-26 00:00:16 +02:00
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:
@@ -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 {})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user