22#ifndef INCLUDED_GR_RUNTIME_RUNTIME_LOG_THREADSAFE_QUEUE_H
23#define INCLUDED_GR_RUNTIME_RUNTIME_LOG_THREADSAFE_QUEUE_H
24#include <condition_variable>
31using lock_t = std::unique_lock<std::mutex>;
36 std::queue<T> the_queue;
42 return the_queue.empty();
46 void push(T&& data)
noexcept
49 the_queue.push(std::move(data));
51 the_condition_variable.notify_one();
58 return the_queue.empty();
65 while (the_queue.empty()) {
66 the_condition_variable.wait(lock);
68 auto& temp = the_queue.front();
75 if (the_queue.empty()) {
76 throw std::out_of_range(
"queue empty");
78 auto& temp = the_queue.front();
Definition: threadsafe_queue.h:34
T & pop() noexcept
Definition: threadsafe_queue.h:62
bool empty() noexcept
Definition: threadsafe_queue.h:54
void push(T &&data) noexcept
Definition: threadsafe_queue.h:46
T & pop_or_throw()
Definition: threadsafe_queue.h:72
std::unique_lock< std::mutex > lock_t
Definition: threadsafe_queue.h:31
boost::mutex mutex
Definition: thread.h:48
boost::condition_variable condition_variable
Definition: thread.h:50
Include this header to use the message passing features.
Definition: basic_block.h:45