diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index 91974252610..04512f3eb40 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -101,6 +101,15 @@ impl Handle { } } + /// Returns true if the currently running `Runtime` is multi-threaded and + /// false otherwise. + pub fn is_multi_threaded(&self) -> bool { + match self.inner { + scheduler::Handle::CurrentThread(_) => false, + scheduler::Handle::MultiThread(_) => true, + } + } + /// Returns a Handle view over the currently running Runtime /// /// Returns an error if no Runtime has been started