9 #ifndef CThreadSafeQueue_H 10 #define CThreadSafeQueue_H 119 if (
m_msgs.empty())
return ret;
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 NULL if there is no message.
This class provides simple critical sections functionality.
A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
CThreadSafeQueue()
Default ctor.
mrpt::synch::CCriticalSection m_csQueue
The critical section.
std::queue< T * > m_msgs
The queue of messages. Memory is freed at destructor or by clients gathering messages.
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.
A thread-safe template queue for object passing between threads; for a template argument of T...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void clear()
Clear the queue of messages, freeing memory as required.
virtual ~CThreadSafeQueue()
bool empty() const
Return true if there are no messages.