mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 15:26:17 +02:00
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:
parent
f601bc0492
commit
44de71a396
1 changed files with 3 additions and 2 deletions
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue