forked from lix-project/lix
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
|
@ -57,11 +57,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Rep, class Period>
|
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)
|
const std::chrono::duration<Rep, Period> & duration)
|
||||||
{
|
{
|
||||||
assert(s);
|
assert(s);
|
||||||
cv.wait_for(lk, duration);
|
return cv.wait_for(lk, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Rep, class Period, class Predicate>
|
template<class Rep, class Period, class Predicate>
|
||||||
|
|
|
@ -75,9 +75,10 @@ public:
|
||||||
updateThread = std::thread([&]() {
|
updateThread = std::thread([&]() {
|
||||||
auto state(state_.lock());
|
auto state(state_.lock());
|
||||||
while (state->active) {
|
while (state->active) {
|
||||||
state.wait(updateCV);
|
auto r = state.wait_for(updateCV, std::chrono::seconds(1));
|
||||||
draw(*state);
|
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