Bredbandskollen CLI  1.2
Asynchronous network task engine
Public Member Functions | List of all members
MsgQueue< T > Class Template Reference

Thread safe queue. More...

#include <msgqueue.h>

Public Member Functions

void push (T t)
 Add object at the end of the queue.
 
bool empty ()
 Return true if the queue is empty.
 
pop_blocking ()
 Wait until there is an object in the queue, then remove and return the first object.
 
bool fetch (T &val)
 A non-blocking pop. More...
 

Detailed Description

template<class T>
class MsgQueue< T >

Thread safe queue.

By design, there is no method named pop. To retrieve an object from the queue, you must use either the non-blocking MsgQueue::fetch or the blocking MsgQueue::pop_blocking method.

Member Function Documentation

◆ fetch()

template<class T >
bool MsgQueue< T >::fetch ( T &  val)
inline

A non-blocking pop.

If the queue is empty, return false. Otherwise remove the first object from the queue, assign it to val, and return true.


The documentation for this class was generated from the following file: