From ae6ca6fb231321770a4bd47769d23d120dc33acc Mon Sep 17 00:00:00 2001 From: James Onnen Date: Sun, 17 Dec 2017 14:20:24 -0600 Subject: [PATCH] Fix #21: High CPU usage in a small project --- src/bin.rs | 5 ++++- src/vfs_watch.rs | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bin.rs b/src/bin.rs index 4c42a4cf..b0ff3a68 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -22,6 +22,7 @@ pub mod vfs_watch; use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex}; use std::thread; +use std::time::Duration; use core::Config; use pathext::canonicalish; @@ -193,7 +194,9 @@ fn main() { println!("Server listening on port {}", port); - loop {} + loop { + thread::sleep(Duration::from_secs(1)); + } }, ("pack", _) => { eprintln!("'rojo pack' is not yet implemented!"); diff --git a/src/vfs_watch.rs b/src/vfs_watch.rs index 697b9ff6..f28e200f 100644 --- a/src/vfs_watch.rs +++ b/src/vfs_watch.rs @@ -92,6 +92,8 @@ impl VfsWatcher { } } - loop {} + loop { + thread::sleep(Duration::from_secs(1)); + } } }