69 std::lock_guard<std::mutex> lock(
m_csQueue);
82 std::lock_guard<std::mutex> lock(
m_csQueue);
92 std::lock_guard<std::mutex> lock(
m_csQueue);
111 std::lock_guard<std::mutex> lock(
m_csQueue);
131 std::lock_guard<std::mutex> lock(
m_csQueue);
138 std::lock_guard<std::mutex> lock(
m_csQueue);
virtual ~CThreadSafeQueue()
void push(T *msg)
Insert a new message in the queue - The object must be created with "new", and do not delete is after...
bool empty() const
Return true if there are no messages.
void clear()
Clear the queue of messages, freeing memory as required.
T * get_lastest_purge_old()
Skip all old messages in the queue and directly return the last one (the most recent, at the bottom of the queue), or nullptr if there is no message.
std::queue< T * > m_msgs
The queue of messages.
CThreadSafeQueue()=default
Default ctor.
A thread-safe template queue for object passing between threads; for a template argument of T...
std::mutex m_csQueue
The critical section.
size_t size() const
Return the number of queued messages.