21 #include <condition_variable>
25 #include <type_traits>
42 std::lock_guard<std::mutex> lock(_queueLock);
43 _queue.push(std::move(value));
45 _condition.notify_one();
50 std::lock_guard<std::mutex> lock(_queueLock);
52 return _queue.empty();
57 std::lock_guard<std::mutex> lock(_queueLock);
62 value = _queue.front();
71 std::unique_lock<std::mutex> lock(_queueLock);
76 _condition.wait(lock);
81 value = _queue.front();
88 std::unique_lock<std::mutex> lock(_queueLock);
90 while (!_queue.empty())
92 T&
value = _queue.front();
101 _condition.notify_all();
105 template<
typename E = T>
108 template<
typename E = T>
std::condition_variable _condition
Definition: ProducerConsumerQueue.h:33
Definition: ProducerConsumerQueue.h:28
std::mutex _queueLock
Definition: ProducerConsumerQueue.h:31
bool Pop(T &value)
Definition: ProducerConsumerQueue.h:55
std::queue< T > _queue
Definition: ProducerConsumerQueue.h:32
std::enable_if<!std::is_pointer< E >::value >::type DeleteQueuedObject(E const &)
Definition: ProducerConsumerQueue.h:109
void WaitAndPop(T &value)
Definition: ProducerConsumerQueue.h:69
std::enable_if< std::is_pointer< E >::value >::type DeleteQueuedObject(E &obj)
Definition: ProducerConsumerQueue.h:106
std::atomic< bool > _shutdown
Definition: ProducerConsumerQueue.h:34
void Push(const T &value)
Definition: ProducerConsumerQueue.h:40
void Cancel()
Definition: ProducerConsumerQueue.h:86
const FieldDescriptor value
Definition: descriptor.h:1522
bool Empty()
Definition: ProducerConsumerQueue.h:48