diff options
author | bdonlan <bdonlan@gmail.com> | 2020-07-14 21:31:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 21:31:13 -0700 |
commit | fc63fa2606e715fd4fef132a1bcfaa18dafdbc6e (patch) | |
tree | 6b368c695e51a75142610b02caaf5cf38ed228f2 /tokio/tests | |
parent | b9e3d2edde33a12ead6df3895caeafa90f9db7e4 (diff) |
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 <bdonlan@amazon.com>
Diffstat (limited to 'tokio/tests')
-rw-r--r-- | tokio/tests/task_blocking.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tokio/tests/task_blocking.rs b/tokio/tests/task_blocking.rs index 72fed01e..b4019868 100644 --- a/tokio/tests/task_blocking.rs +++ b/tokio/tests/task_blocking.rs @@ -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 {}) + }) + }); +} |