From b019532bc26683c21e4335ea4f6cdb45aa4689aa Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Thu, 5 Jul 2018 19:19:49 +0200 Subject: [PATCH] Implement status() for DefaultExecutor (#463) --- tokio-executor/src/global.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tokio-executor/src/global.rs b/tokio-executor/src/global.rs index ab4d526dc..8b5a47198 100644 --- a/tokio-executor/src/global.rs +++ b/tokio-executor/src/global.rs @@ -79,6 +79,20 @@ impl super::Executor for DefaultExecutor { } }) } + + fn status(&self) -> Result<(), SpawnError> { + EXECUTOR.with(|current_executor| { + match current_executor.get() { + Some(executor) => { + let executor = unsafe { &mut *executor }; + executor.status() + } + None => { + Err(SpawnError::shutdown()) + } + } + }) + } } // ===== global spawn fns =====