From 5b77313133c49d6aa1056930f3193f2c8e579c6e Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Fri, 17 Apr 2020 19:13:46 +0200 Subject: [PATCH] Add sleep at start of thread --- sf-buffer/src/sf_buffer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sf-buffer/src/sf_buffer.cpp b/sf-buffer/src/sf_buffer.cpp index f8e7a88..df7cc03 100644 --- a/sf-buffer/src/sf_buffer.cpp +++ b/sf-buffer/src/sf_buffer.cpp @@ -46,10 +46,14 @@ int main (int argc, char *argv[]) { // TODO: Optimize this away and pass it with the RB. auto* jf_file_format_buffer = new JFFileFormat(); + // Wait for 1 event to accumulate. + this_thread::sleep_for(chrono::milliseconds(10)); + while (true) { auto data = ring_buffer.read(); if (data.first == nullptr) { + // TODO: Try to sleep at the end of a succesful loop. this_thread::sleep_for(chrono::milliseconds(10)); continue; }