mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02: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:
commit
629398d05c
2 changed files with 5 additions and 4 deletions
|
@ -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>
|
||||
|
|
|
@ -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