Skip to content

Commit d759b28

Browse files
committed
using tokio block on a thread for better concurrent
1 parent ba39e42 commit d759b28

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

asm_server/src/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ impl AsmServer {
2525
pub fn smart_open(server: ServerMut, path: &str, render_target: AppContainer) {
2626
let context = FileOpenContext { path: path.to_string(), start_time: Instant::now() };
2727
std::thread::spawn(move || {
28-
// let tokio_runtime = runtime::Builder::new_multi_thread()
29-
// .enable_all().build().unwrap();
30-
// tokio_runtime.spawn(async move {
28+
let tokio_runtime = runtime::Builder::new_multi_thread()
29+
.enable_all().build().unwrap();
30+
tokio_runtime.block_on(async move {
3131
let new_server = AsmServer::new();
3232
let path = &context.path;
3333
let accessor = new_server.accessor.clone();
@@ -50,7 +50,7 @@ impl AsmServer {
5050
};
5151
*server.lock().unwrap() = Some(new_server.clone());
5252
new_server.on_file_opened(&context, render_target);
53-
// })
53+
})
5454
});
5555
}
5656

0 commit comments

Comments
 (0)