Use std:🧵: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 <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-08-04 23:01:26 +10:00
parent f4dd75ef9b
commit cea67b2e54
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -1,7 +1,9 @@
use std::io::{self, BufRead, Write}; use std::{
io::{self, BufRead, Write},
thread,
};
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tokio::task::spawn_blocking;
use crate::BinstallError; use crate::BinstallError;
@ -19,7 +21,7 @@ impl UIThreadInner {
let (request_tx, mut request_rx) = mpsc::channel(1); let (request_tx, mut request_rx) = mpsc::channel(1);
let (confirm_tx, confirm_rx) = mpsc::channel(10); let (confirm_tx, confirm_rx) = mpsc::channel(10);
spawn_blocking(move || { thread::spawn(move || {
// This task should be the only one able to // This task should be the only one able to
// access stdin // access stdin
let mut stdin = io::stdin().lock(); let mut stdin = io::stdin().lock();