progress-bar: re-draw last update if nothing new for 1sec.

Slightly nicer behavior when updates are somewhat far apart
(during a long linking step, perhaps) ensuring things
don't appear unresponsive.

If we wait the maximum amount for the update,
don't bother waiting another 50ms (for rate-limiting purposes)
and just check if we should quit.

This also ensures we'll notice the request to quit within 1s
if quit is signalled but there is not an udpate.
(I'm not sure if this happens or not)
This commit is contained in:
Will Dietz 2018-06-18 17:33:35 -05:00
parent f601bc0492
commit 44de71a396

View file

@ -75,9 +75,10 @@ public:
updateThread = std::thread([&]() {
auto state(state_.lock());
while (state->active) {
state.wait(updateCV);
auto r = state.wait_for(updateCV, std::chrono::seconds(1));
draw(*state);
state.wait_for(quitCV, std::chrono::milliseconds(50));
if (r == std::cv_status::no_timeout)
state.wait_for(quitCV, std::chrono::milliseconds(50));
}
});
}