summaryrefslogtreecommitdiff
path: root/boost/thread/concurrent_queues/sync_deque.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/thread/concurrent_queues/sync_deque.hpp')
-rw-r--r--boost/thread/concurrent_queues/sync_deque.hpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/boost/thread/concurrent_queues/sync_deque.hpp b/boost/thread/concurrent_queues/sync_deque.hpp
index c84dae022a..c6159c4be0 100644
--- a/boost/thread/concurrent_queues/sync_deque.hpp
+++ b/boost/thread/concurrent_queues/sync_deque.hpp
@@ -149,11 +149,7 @@ namespace concurrent
template <class ValueType, class Container>
queue_op_status sync_deque<ValueType, Container>::wait_pull_front(ValueType& elem, unique_lock<mutex>& lk)
{
- if (super::empty(lk))
- {
- if (super::closed(lk)) return queue_op_status::closed;
- }
- bool has_been_closed = super::wait_until_not_empty_or_closed(lk);
+ const bool has_been_closed = super::wait_until_not_empty_or_closed(lk);
if (has_been_closed) return queue_op_status::closed;
pull_front(elem, lk);
return queue_op_status::success;
@@ -188,7 +184,8 @@ namespace concurrent
void sync_deque<ValueType, Container>::pull_front(ValueType& elem)
{
unique_lock<mutex> lk(super::mtx_);
- super::wait_until_not_empty(lk);
+ const bool has_been_closed = super::wait_until_not_empty_or_closed(lk);
+ if (has_been_closed) super::throw_if_closed(lk);
pull_front(elem, lk);
}
@@ -197,7 +194,8 @@ namespace concurrent
ValueType sync_deque<ValueType, Container>::pull_front()
{
unique_lock<mutex> lk(super::mtx_);
- super::wait_until_not_empty(lk);
+ const bool has_been_closed = super::wait_until_not_empty_or_closed(lk);
+ if (has_been_closed) super::throw_if_closed(lk);
return pull_front(lk);
}