Debian Codegraph @

third_party/rust/tokio/src/runtime/scheduler/block_in_place.rs

raw
1 use crate::runtime::scheduler;
2
3 #[track_caller]
4 pub(crate) fn block_in_place<F, R>(f: F) -> R
5 where
6 F: FnOnce() -> R,
7 {
8 #[cfg(tokio_unstable)]
9 {
10 use crate::runtime::{Handle, RuntimeFlavor::MultiThreadAlt};
11
12 match Handle::try_current().map(|h| h.runtime_flavor()) {
13 Ok(MultiThreadAlt) => {
14 return scheduler::multi_thread_alt::block_in_place(f);
15 }
16 _ => {}
17 }
18 }
19
20 scheduler::multi_thread::block_in_place(f)
21 }