add comment documenting why we sleep

This commit is contained in:
Isaac Connor 2022-01-11 17:02:05 -05:00
parent cd6c44db47
commit ff91ac62fb
1 changed files with 1 additions and 1 deletions

View File

@ -24,9 +24,9 @@ void AnalysisThread::Start() {
void AnalysisThread::Run() {
while (!(terminate_ or zm_terminate)) {
// Some periodic updates are required for variable capturing framerate
Debug(2, "Analyzing");
if (!monitor_->Analyse()) {
if (!(terminate_ or zm_terminate)) {
// We only sleep when Analyse returns false because it is an error condition and we will spin like mad if it persists.
Microseconds sleep_for = monitor_->Active() ? Microseconds(ZM_SAMPLE_RATE) : Microseconds(ZM_SUSPENDED_RATE);
Debug(2, "Sleeping for %" PRId64 "us", int64(sleep_for.count()));
std::this_thread::sleep_for(sleep_for);