mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
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:
parent
f4dd75ef9b
commit
cea67b2e54
1 changed files with 5 additions and 3 deletions
|
@ -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();
|
||||||
|
|
Loading…
Add table
Reference in a new issue