diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-07-31 17:02:20 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-31 11:02:20 -0400 |
commit | e7cee29c849286f9b492eb404634a0387b9a75a0 (patch) | |
tree | 00d3541e8b17837381c23df880ab4a19887aaa19 /cli/tokio_util.rs | |
parent | 421cbd39b4f0fdbdfc2eeed6da8dd3410246a044 (diff) |
Add --current-thread flag (#2702)
Diffstat (limited to 'cli/tokio_util.rs')
-rw-r--r-- | cli/tokio_util.rs | 7 |
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 |