diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/update.cc | 7 | ||||
| -rw-r--r-- | src/lib/update.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/update.cc b/src/lib/update.cc index 6e5f92edc..a98ee5b5d 100644 --- a/src/lib/update.cc +++ b/src/lib/update.cc @@ -48,6 +48,7 @@ UpdateChecker::UpdateChecker () , _curl (0) , _state (NOT_RUN) , _emits (0) + , _to_do (0) { curl_global_init (CURL_GLOBAL_ALL); _curl = curl_easy_init (); @@ -76,6 +77,7 @@ void UpdateChecker::run () { boost::mutex::scoped_lock lm (_process_mutex); + _to_do++; _condition.notify_one (); } @@ -84,7 +86,10 @@ UpdateChecker::thread () { while (1) { boost::mutex::scoped_lock lock (_process_mutex); - _condition.wait (lock); + while (_to_do == 0) { + _condition.wait (lock); + } + --_to_do; lock.unlock (); try { diff --git a/src/lib/update.h b/src/lib/update.h index a1aefd0a1..c19173911 100644 --- a/src/lib/update.h +++ b/src/lib/update.h @@ -84,4 +84,5 @@ private: boost::thread* _thread; boost::mutex _process_mutex; boost::condition _condition; + int _to_do; }; |
