summaryrefslogtreecommitdiffstats
path: root/tokio/src/future/block_on.rs
blob: 91f9cc00550cb3a5bc30e68e881f93330e040517 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::future::Future;

cfg_rt! {
    pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
        let mut e = crate::runtime::enter::enter(false);
        e.block_on(f).unwrap()
    }
}

cfg_not_rt! {
    pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
        let mut park = crate::park::thread::CachedParkThread::new();
        park.block_on(f).unwrap()
    }
}