diff options
author | Gordon Sim <gsim@apache.org> | 2008-07-10 08:39:10 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-07-10 08:39:10 +0000 |
commit | f8078da6c6617ce5359fa90feca93e191c6c014f (patch) | |
tree | 252b412803448a2f2396d33f02c492a61f6975ce | |
parent | 884c89d1aa056e89ab365108d418bdaee5745368 (diff) | |
download | qpid-python-f8078da6c6617ce5359fa90feca93e191c6c014f.tar.gz |
Honour timeout in BlockingQueue::pop(); added test for SubscriptionManager::get() where no message exists.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@675477 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/src/qpid/sys/BlockingQueue.h | 2 | ||||
-rw-r--r-- | cpp/src/tests/ClientSessionTest.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/BlockingQueue.h b/cpp/src/qpid/sys/BlockingQueue.h index 9bb215ff7f..4402c242e6 100644 --- a/cpp/src/qpid/sys/BlockingQueue.h +++ b/cpp/src/qpid/sys/BlockingQueue.h @@ -52,7 +52,7 @@ public: { Waitable::ScopedWait w(waitable); AbsTime deadline(now(),timeout); - while (queue.empty()) waitable.wait(deadline); + while (queue.empty() && deadline > now()) waitable.wait(deadline); } if (queue.empty()) return false; result = queue.front(); diff --git a/cpp/src/tests/ClientSessionTest.cpp b/cpp/src/tests/ClientSessionTest.cpp index b55e4c231e..90616cf7f3 100644 --- a/cpp/src/tests/ClientSessionTest.cpp +++ b/cpp/src/tests/ClientSessionTest.cpp @@ -248,6 +248,7 @@ QPID_AUTO_TEST_CASE(testGet) { BOOST_CHECK_EQUAL("foo0", got.getData()); BOOST_CHECK(fix.subs.get(got, "getq", TIME_SEC)); BOOST_CHECK_EQUAL("foo1", got.getData()); + BOOST_CHECK(!fix.subs.get(got, "getq")); } QPID_AUTO_TEST_CASE(testOpenFailure) { |