Skip to content
Snippets Groups Projects
Unverified Commit 629398d0 authored by Eelco Dolstra's avatar Eelco Dolstra Committed by GitHub
Browse files

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

progress-bar: refresh occasionally even if no updates are received
parents 1fb475e7 44de71a3
No related branches found
No related tags found
No related merge requests found
...@@ -57,11 +57,11 @@ public: ...@@ -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: ...@@ -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));
} }
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment