1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

Merge pull request #2241 from dtzWill/feature/refresh-progress-bar

progress-bar: refresh occasionally even if no updates are received
This commit is contained in:
Eelco Dolstra 2018-06-19 09:13:58 +02:00 committed by GitHub
commit 629398d05c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -57,11 +57,11 @@ public:
}
template<class Rep, class Period>
void wait_for(std::condition_variable & cv,
std::cv_status wait_for(std::condition_variable & cv,
const std::chrono::duration<Rep, Period> & duration)
{
assert(s);
cv.wait_for(lk, duration);
return cv.wait_for(lk, duration);
}
template<class Rep, class Period, class Predicate>

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));
}
});
}