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);
A thread-safe template queue for object passing between threads; for a template argument of T,...
std::queue< T * > m_msgs
The queue of messages.
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.
void push(T *msg)
Insert a new message in the queue - The object must be created with "new", and do not delete is after...
std::mutex m_csQueue
The critical section.
T * get_lastest_purge_old()
Skip all old messages in the queue and directly return the last one (the most recent,...
bool empty() const
Return true if there are no messages.
virtual ~CThreadSafeQueue()
CThreadSafeQueue()
Default ctor.
void clear()
Clear the queue of messages, freeing memory as required.