1 #ifndef theplu_yat_utility_queue 2 #define theplu_yat_utility_queue 23 #include <boost/thread.hpp> 66 typedef typename std::deque<T>::size_type
size_type;
87 boost::unique_lock<boost::mutex> lock(mutex_);
96 boost::unique_lock<boost::mutex> lock(mutex_);
110 boost::unique_lock<boost::mutex> lock(mutex_);
112 condition_.wait(lock);
128 boost::unique_lock<boost::mutex> lock(mutex_);
133 condition_.notify_one();
137 #ifdef YAT_HAVE_RVALUE 147 boost::unique_lock<boost::mutex> lock(mutex_);
148 q_.push_back(std::move(t));
152 condition_.notify_one();
162 boost::unique_lock<boost::mutex> lock(mutex_);
173 boost::unique_lock<boost::mutex> lock(mutex_);
187 boost::unique_lock<boost::mutex> lock(mutex_);
194 mutable boost::mutex mutex_;
195 boost::condition_variable condition_;
198 const std::deque<T>& q(
void)
const 200 boost::unique_lock<boost::mutex> lock(mutex_);
std::deque< T >::size_type size_type
Definition: Queue.h:66
The Department of Theoretical Physics namespace as we define it.
bool empty(void) const
Definition: Queue.h:94
bool try_pop(T &value)
Definition: Queue.h:171
Queue(void)
Create a Queue with no elements.
Definition: Queue.h:71
void clear(void)
clear queue
Definition: Queue.h:85
Multi-thread safe queue.
Definition: Queue.h:57
Queue(const Queue &other)
Copy constructor.
Definition: Queue.h:78
T value_type
Type of object stored in Queue.
Definition: Queue.h:61
void pop(T &value)
access next element in queue
Definition: Queue.h:108
void push(const T &t)
insert an element into container
Definition: Queue.h:126
size_type size(void) const
Definition: Queue.h:160
Queue & operator=(const Queue &lhs)
assignment operator
Definition: Queue.h:185