deno/cli/tokio_util.rs
Ryan Dahl 2338e7679c
Remove --current-thread flag (#3830)
This flag was added to evaluate performance relative to tokio's threaded
runtime. Although it's faster in the HTTP benchmark, it's clear the runtime
is not the only perf problem.

Removing this flag will simplify further refactors, in particular
adopting the #[tokio::main] macro. This will be done in a follow up.

Ultimately we expect to move to the current thread runtime with Isolates
pinned to specific threads, but that will be a much larger refactor. The
--current-thread just complicates that effort.
2020-01-30 10:49:33 -05:00

18 lines
401 B
Rust

// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use std::future::Future;
use tokio;
use tokio::runtime;
pub fn run<F>(future: F)
where
F: Future<Output = ()> + Send + 'static,
{
let mut rt = runtime::Builder::new()
.threaded_scheduler()
.enable_all()
.thread_name("deno")
.build()
.expect("Unable to create Tokio runtime");
rt.block_on(future);
}