diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-11 21:48:00 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-11 21:48:00 -0500 |
commit | 35a7db590aab2c8d1508115a490678fce6376000 (patch) | |
tree | 7c446e93616b938e397879700d4228600c496da9 /src | |
parent | cf49952cb1d0c5a4b233bb54a29a0c580f73360d (diff) | |
download | nbsh-35a7db590aab2c8d1508115a490678fce6376000.tar.gz nbsh-35a7db590aab2c8d1508115a490678fce6376000.zip |
move the std channel adaptor thread onto the thread pool
instead of managing a separate thread manually
Diffstat (limited to 'src')
-rw-r--r-- | src/shell/mod.rs | 4 |
1 files 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<i32> { 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<i32> { break; } } - }); + })); let event_w = event_w.clone(); async_std::task::spawn(async move { while watch_r.recv().await.is_ok() { |