From 5ef257a3b9b831cfbe1330d6985d1852f55af72f Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Sat, 2 Sep 2017 01:44:42 -0400 Subject: [PATCH] puts `thread::sleep`s behind a "no-thrash" feature --- Cargo.toml | 3 +++ src/influx.rs | 1 + src/latency.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index e72c8af..6400892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,3 +15,6 @@ sloggers = "0.2" windows = { path = "../windows" } money = { path = "../money" } + +[features] +no-thrash = [] diff --git a/src/influx.rs b/src/influx.rs index 24c7907..8c2d7e0 100644 --- a/src/influx.rs +++ b/src/influx.rs @@ -401,6 +401,7 @@ pub fn writer_str_or_meas(log_path: &str, warnings: Sender) -> (thread: }); if !rcvd_msg { + #[cfg(feature = "no-thrash")] thread::sleep(Duration::from_millis(1) / 10); } } diff --git a/src/latency.rs b/src/latency.rs index f45272c..039afb8 100644 --- a/src/latency.rs +++ b/src/latency.rs @@ -400,6 +400,7 @@ impl Manager { last.broadcast = loop_time; debug!(logger, "sent broadcast"); } else { + #[cfg(feature = "no-thrash")] thread::sleep(Duration::from_millis(1) / 10); }