38#ifndef SYNCHRONIZED_QUEUE_H_
39#define SYNCHRONIZED_QUEUE_H_
41#include <condition_variable>
61template<
typename T = struct msg *,
int max_len = 1>
66 std::unique_lock<std::mutex> l(
m_lock);
72 std::unique_lock<std::mutex> l(
m_lock);
83 std::unique_lock<std::mutex> l(
m_lock);
92 T
pop(
bool nonblocking =
false)
94 std::unique_lock<std::mutex> l(
m_lock);
95 if (
m_queue.size() == 0 && nonblocking) {
100 T ret = std::move(
m_queue.front());
108 template<
typename Rep,
typename Period>
109 bool timed_pop(T& result, std::chrono::duration<Rep, Period>
const& timeout)
111 std::unique_lock<std::mutex> l(
m_lock);
115 result = std::move(
m_queue.front());
129#ifndef NO_EXTERN_MSGQ_MSG
simple blocking synchronized queue
T pop(bool nonblocking=false)
bool timed_pop(T &result, std::chrono::duration< Rep, Period > const &timeout)
std::condition_variable m_queue_decremented
std::condition_variable m_queue_incremented
void push(T const &message)