From 35a7db590aab2c8d1508115a490678fce6376000 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 11 Jan 2022 21:48:00 -0500 Subject: move the std channel adaptor thread onto the thread pool instead of managing a separate thread manually --- src/shell/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index f909dca..e7160be 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -104,7 +104,7 @@ pub async fn main() -> anyhow::Result { watcher .watch(&dir, notify::RecursiveMode::Recursive) .unwrap(); - std::thread::spawn(move || { + async_std::task::spawn(blocking::unblock(move || { while let Ok(event) = sync_watch_r.recv() { let watch_w = watch_w.clone(); let send_failed = @@ -115,7 +115,7 @@ pub async fn main() -> anyhow::Result { break; } } - }); + })); let event_w = event_w.clone(); async_std::task::spawn(async move { while watch_r.recv().await.is_ok() { -- cgit v1.2.3-54-g00ecf