1use std::future::Future;
23cfg_rt! {
4#[track_caller]
5pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
6let mut e = crate::runtime::context::try_enter_blocking_region().expect(
7"Cannot block the current thread from within a runtime. This \
8 happens because a function attempted to block the current \
9 thread while the thread is being used to drive asynchronous \
10 tasks."
11);
12 e.block_on(f).unwrap()
13 }
14}
1516cfg_not_rt! {
17#[track_caller]
18pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
19let mut park = crate::runtime::park::CachedParkThread::new();
20 park.block_on(f).unwrap()
21 }
22}