24 #include <condition_variable> 29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 51 std::lock_guard<std::mutex> lock(m_mutex);
53 if (m_queue.empty()) {
57 value = m_queue.front();
68 std::unique_lock<std::mutex> lock(m_mutex);
69 m_condition.wait(lock, [
this]() {
return !m_queue.empty(); });
70 value = m_queue.front();
80 std::lock_guard<std::mutex> lock(m_mutex);
81 m_queue.push_back(value);
82 m_condition.notify_one();
91 std::lock_guard<std::mutex> lock(m_mutex);
92 m_queue.push_back(std::move(value));
93 m_condition.notify_one();
100 std::lock_guard<std::mutex> lock(m_mutex);
106 std::condition_variable m_condition;
107 std::deque<T> m_queue;
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS void push(T &&value)
Push a value on the queue.
Definition: Queue.h:90
void wait(T &value)
Wait for a value from the queue.
Definition: Queue.h:67
void push(const T &value)
Push a value on the queue.
Definition: Queue.h:79
A simple concurrent queue.
Definition: Queue.h:42
bool poll(T &value)
Poll a value from the queue, if possible.
Definition: Queue.h:50
The namespace for gf classes.
Definition: Action.h:35
void clear()
Clear the queue.
Definition: Queue.h:99