summaryrefslogtreecommitdiff
path: root/boost/thread/concurrent_queues/sync_bounded_queue.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/thread/concurrent_queues/sync_bounded_queue.hpp')
-rw-r--r--boost/thread/concurrent_queues/sync_bounded_queue.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/boost/thread/concurrent_queues/sync_bounded_queue.hpp b/boost/thread/concurrent_queues/sync_bounded_queue.hpp
index e34fa56f37..fd36f8c1a4 100644
--- a/boost/thread/concurrent_queues/sync_bounded_queue.hpp
+++ b/boost/thread/concurrent_queues/sync_bounded_queue.hpp
@@ -127,7 +127,7 @@ namespace concurrent
inline size_type size(lock_guard<mutex>& lk) const BOOST_NOEXCEPT
{
if (full(lk)) return capacity(lk);
- return ((out_+capacity(lk)-in_) % capacity(lk));
+ return ((in_+capacity(lk)-out_) % capacity(lk));
}
inline void throw_if_closed(unique_lock<mutex>&);
@@ -484,7 +484,9 @@ namespace concurrent
queue_op_status sync_bounded_queue<ValueType>::wait_pull_front(ValueType& elem, unique_lock<mutex>& lk)
{
if (empty(lk) && closed(lk)) {return queue_op_status::closed;}
- wait_until_not_empty(lk);
+ bool is_closed = false;
+ wait_until_not_empty(lk, is_closed);
+ if (is_closed) {return queue_op_status::closed;}
pull_front(elem, lk);
return queue_op_status::success;
}