summaryrefslogtreecommitdiff
path: root/cli/tokio_util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tokio_util.rs')
-rw-r--r--cli/tokio_util.rs7
1 files changed, 7 insertions, 0 deletions
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<F>(future: F)
+where
+ F: Future<Item = (), Error = ()> + 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