Go to the documentation of this file.
71 std::lock_guard<std::mutex> lock(
m_csQueue);
84 std::lock_guard<std::mutex> lock(
m_csQueue);
94 std::lock_guard<std::mutex> lock(
m_csQueue);
113 std::lock_guard<std::mutex> lock(
m_csQueue);
133 std::lock_guard<std::mutex> lock(
m_csQueue);
140 std::lock_guard<std::mutex> lock(
m_csQueue);
T * get()
Retrieve the next message in the queue, or nullptr if there is no message.
size_t size() const
Return the number of queued messages.
std::mutex m_csQueue
The critical section.
virtual ~CThreadSafeQueue()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::queue< T * > m_msgs
The queue of messages.
bool empty() const
Return true if there are no 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...
CThreadSafeQueue()
Default ctor.
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,...
A thread-safe template queue for object passing between threads; for a template argument of T,...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |