diff options
author | Will Dietz <w@wdtz.org> | 2018-06-18 17:33:35 -0500 |
---|---|---|
committer | Will Dietz <w@wdtz.org> | 2018-06-18 17:54:09 -0500 |
commit | 44de71a39624d86d6744062ee36f57170024c9a0 (patch) | |
tree | b377e2827a6fed7a13c4c28ca970f693d1a74e64 /src/nix | |
parent | f601bc049258ed438aa6f8199c5be11770d44aaf (diff) |
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)
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/progress-bar.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nix/progress-bar.cc b/src/nix/progress-bar.cc index 40b905ba3..8093d8761 100644 --- a/src/nix/progress-bar.cc +++ b/src/nix/progress-bar.cc @@ -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)); } }); } |