From f2f4792f824cd64e679cdc859fb008769541257b Mon Sep 17 00:00:00 2001 From: Vasile Vilvoiu Date: Sat, 6 May 2023 20:40:52 +0300 Subject: Add support for waiting for input. Introduce -S/--sleep_for_input command line argument. Closes #17. --- src/specgram.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/specgram.cpp') diff --git a/src/specgram.cpp b/src/specgram.cpp index 0cd9635..5e5e30c 100644 --- a/src/specgram.cpp +++ b/src/specgram.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include /* main loop exit condition */ volatile bool main_loop_running = true; @@ -237,6 +239,10 @@ main(int argc, char** argv) auto block = reader->GetBlock(); if (!block) { /* block not finished yet */ + if (auto sleep = conf.GetSleepForInput()) { + /* sleep for a bit so we don't busywait on sparse input */ + std::this_thread::sleep_for(std::chrono::duration(sleep)); + } continue; } -- cgit v1.2.3