9#ifndef CThreadSafeQueue_H
10#define CThreadSafeQueue_H
119 if (
m_msgs.empty())
return ret;
This class provides simple critical sections functionality.
A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
A thread-safe template queue for object passing between threads; for a template argument of T,...
bool empty() const
Return true if there are no messages.
T * get()
Retrieve the next message in the queue, or NULL if there is no message.
CThreadSafeQueue()
Default ctor.
void clear()
Clear the queue of messages, freeing memory as required.
void push(T *msg)
Insert a new message in the queue - The object must be created with "new", and do not delete is after...
size_t size() const
Return the number of queued messages.
T * get_lastest_purge_old()
Skip all old messages in the queue and directly return the last one (the most recent,...
std::queue< T * > m_msgs
The queue of messages. Memory is freed at destructor or by clients gathering messages.
virtual ~CThreadSafeQueue()
mrpt::synch::CCriticalSection m_csQueue
The critical section.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.