24 #include <condition_variable> 28 #include "Portability.h" 31 #ifndef DOXYGEN_SHOULD_SKIP_THIS 53 std::lock_guard<std::mutex> lock(m_mutex);
55 if (m_queue.empty()) {
59 value = m_queue.front();
70 std::unique_lock<std::mutex> lock(m_mutex);
71 m_condition.wait(lock, [
this]() {
return !m_queue.empty(); });
72 value = m_queue.front();
82 std::lock_guard<std::mutex> lock(m_mutex);
83 m_queue.push_back(value);
84 m_condition.notify_one();
93 std::lock_guard<std::mutex> lock(m_mutex);
94 m_queue.push_back(std::move(value));
95 m_condition.notify_one();
102 std::lock_guard<std::mutex> lock(m_mutex);
108 std::condition_variable m_condition;
109 std::deque<T> m_queue;
112 #ifndef DOXYGEN_SHOULD_SKIP_THIS void push(T &&value)
Push a value on the queue.
Definition: Queue.h:92
void wait(T &value)
Wait for a value from the queue.
Definition: Queue.h:69
void push(const T &value)
Push a value on the queue.
Definition: Queue.h:81
A simple concurrent queue.
Definition: Queue.h:44
bool poll(T &value)
Poll a value from the queue, if possible.
Definition: Queue.h:52
The namespace for gf classes.
Definition: Action.h:35
void clear()
Clear the queue.
Definition: Queue.h:101