From cea67b2e54abbb33e83e95493d9cebdf594e28d7 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 4 Aug 2022 23:01:26 +1000 Subject: [PATCH] Use `std::thread::spawn` in `UIThreadInner` instead of `tokio::task::spawn_blocking` so that dropping rt would not block the main thread until the ui thread is exit (which might never exit). Signed-off-by: Jiahao XU --- src/helpers/ui_thread.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/helpers/ui_thread.rs b/src/helpers/ui_thread.rs index 8daf945c..8cc42a6e 100644 --- a/src/helpers/ui_thread.rs +++ b/src/helpers/ui_thread.rs @@ -1,7 +1,9 @@ -use std::io::{self, BufRead, Write}; +use std::{ + io::{self, BufRead, Write}, + thread, +}; use tokio::sync::mpsc; -use tokio::task::spawn_blocking; use crate::BinstallError; @@ -19,7 +21,7 @@ impl UIThreadInner { let (request_tx, mut request_rx) = mpsc::channel(1); let (confirm_tx, confirm_rx) = mpsc::channel(10); - spawn_blocking(move || { + thread::spawn(move || { // This task should be the only one able to // access stdin let mut stdin = io::stdin().lock();