[Pkg-running-devel] [antpm] 13/48: lqueue: handle spurious wakeups

Kristof Ralovich ralovich-guest at moszumanska.debian.org
Mon Aug 11 10:10:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

ralovich-guest pushed a commit to branch upstream
in repository antpm.

commit 03826509582b016e1b4b64141402b0f7799ba95f
Author: RALOVICH, Kristof <tade60 at freemail.hu>
Date:   Wed Mar 26 11:45:48 2014 +0100

    lqueue: handle spurious wakeups
---
 src/lqueue.hpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lqueue.hpp b/src/lqueue.hpp
index 1b52c07..cfb95c8 100644
--- a/src/lqueue.hpp
+++ b/src/lqueue.hpp
@@ -194,14 +194,15 @@ public:
   {
     boost::mutex::scoped_lock lock(Super::m_mtx);
 
-    /// if queue empty, wait untile timeout if there was anything pushed
+    /// if queue empty, wait until timeout if there was anything pushed
     if(Super::m_q.empty() && timeout > 0)
     {
       boost::posix_time::time_duration td = boost::posix_time::milliseconds(timeout);
       if(!Super::m_pushEvent.timed_wait(lock, td))
         return false;
     }
-    assert(!Super::m_q.empty());
+    if(Super::m_q.empty()) // spurious wakeup
+      return false;
 
     data = Super::m_q.front();
     Super::m_q.pop_front();
@@ -226,7 +227,8 @@ public:
         return false;
       }
     }
-    assert(!Super::m_q.empty());
+    if(Super::m_q.empty()) // spurious wakeup
+      return false;
 
     size_t s = Super::m_q.size();
     s = std::min(s, sizeBytes);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/antpm.git



More information about the Pkg-running-devel mailing list