oasis_core_runtime/
future.rs1use std::future::Future;
3
4#[cfg(any(target_env = "sgx", feature = "debug-mock-sgx"))]
6pub fn new_tokio_runtime() -> tokio::runtime::Runtime {
7 tokio::runtime::Builder::new_multi_thread()
11 .worker_threads(6)
12 .max_blocking_threads(16)
13 .thread_keep_alive(std::time::Duration::MAX)
14 .enable_all()
15 .build()
16 .unwrap()
17}
18
19#[cfg(not(any(target_env = "sgx", feature = "debug-mock-sgx")))]
21pub fn new_tokio_runtime() -> tokio::runtime::Runtime {
22 tokio::runtime::Runtime::new().unwrap()
24}
25
26pub fn block_on<F: Future>(future: F) -> F::Output {
28 tokio::runtime::Handle::current().block_on(future)
29}