1 use std::future::Future;
2 
3 cfg_rt! {
4     #[track_caller]
5     pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
6         let 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 }
15 
16 cfg_not_rt! {
17     #[track_caller]
18     pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
19         let mut park = crate::runtime::park::CachedParkThread::new();
20         park.block_on(f).unwrap()
21     }
22 }
23