From e7cee29c849286f9b492eb404634a0387b9a75a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 31 Jul 2019 17:02:20 +0200 Subject: Add --current-thread flag (#2702) --- cli/tokio_util.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cli/tokio_util.rs') diff --git a/cli/tokio_util.rs b/cli/tokio_util.rs index 4c4b36d5e..7bbfeee65 100644 --- a/cli/tokio_util.rs +++ b/cli/tokio_util.rs @@ -26,6 +26,13 @@ where rt.block_on_all(future).unwrap(); } +pub fn run_on_current_thread(future: F) +where + F: Future + Send + 'static, +{ + tokio::runtime::current_thread::run(future); +} + /// THIS IS A HACK AND SHOULD BE AVOIDED. /// /// This creates a new tokio runtime, with many new threads, to execute the -- cgit v1.2.3