diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/goma.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/goma.cc b/src/goma.cc index c82920d..47f0a43 100644 --- a/src/goma.cc +++ b/src/goma.cc @@ -28,6 +28,14 @@ struct State { std::string msg_; uint64_t running_{0}; uint64_t failed_{0}; + + bool operator==(State const& state) const { + if (error_ != state.error_) + return false; + if (error_) + return msg_ == state.msg_; + return running_ == state.running_ && failed_ == state.failed_; + } }; class GomaPoll { @@ -86,9 +94,11 @@ private: { std::unique_lock<std::mutex> lock(mutex_); - state_ = state; - io::write(pipe_, "s", 1); - cond_.wait_for(lock, std::chrono::seconds(1)); + if (!(state_ == state)) { + state_ = state; + io::write(pipe_, "s", 1); + } + cond_.wait_for(lock, std::chrono::seconds(5)); if (quit_) break; } |
