From ae916929c95d676c14279d701f105819e9e62a13 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 10 Dec 2019 20:11:11 -0800 Subject: Simplify a status-checking loop --- utils/makemhr/makemhr.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'utils') diff --git a/utils/makemhr/makemhr.cpp b/utils/makemhr/makemhr.cpp index 42a384db..f10083a5 100644 --- a/utils/makemhr/makemhr.cpp +++ b/utils/makemhr/makemhr.cpp @@ -812,17 +812,16 @@ static void ReconstructHrirs(const HrirDataT *hData) /* Keep track of the number of IRs done, periodically reporting it. */ size_t count; - while((count=reconstructor.mDone.load()) != total) - { + do { + std::this_thread::sleep_for(std::chrono::milliseconds{50}); + + count = reconstructor.mDone.load(); size_t pcdone{count * 100 / total}; printf("\r%3zu%% done (%zu of %zu)", pcdone, count, total); fflush(stdout); - - std::this_thread::sleep_for(std::chrono::milliseconds{50}); - } - size_t pcdone{count * 100 / total}; - printf("\r%3zu%% done (%zu of %zu)\n", pcdone, count, total); + } while(count != total); + fputc('\n', stdout); if(thrd2.joinable()) thrd2.join(); if(thrd1.joinable()) thrd1.join(); -- cgit v1.2.3