Gamedev Framework (gf)  0.11.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::Queue< T > Class Template Reference

A simple concurrent queue. More...

#include <gf/Queue.h>

Public Member Functions

bool poll (T &value)
 Poll a value from the queue, if possible. More...
 
void wait (T &value)
 Wait for a value from the queue. More...
 
void push (const T &value)
 Push a value on the queue. More...
 
void push (T &&value)
 Push a value on the queue. More...
 
void clear ()
 Clear the queue. More...
 

Detailed Description

template<typename T>
class gf::Queue< T >

A simple concurrent queue.

This is a simple concurrent queue that can be used in a multi-threaded application. For example, it can be used between a thread that receives messages from the network and the main loop that handles the messages.

Member Function Documentation

◆ clear()

template<typename T >
void gf::Queue< T >::clear ( )
inline

Clear the queue.

◆ poll()

template<typename T >
bool gf::Queue< T >::poll ( T value)
inline

Poll a value from the queue, if possible.

Parameters
valueA reference for the result
Returns
True if a value was poped from the queue

◆ push() [1/2]

template<typename T >
void gf::Queue< T >::push ( const T value)
inline

Push a value on the queue.

Parameters
valueThe value to push on the queue

◆ push() [2/2]

template<typename T >
void gf::Queue< T >::push ( T &&  value)
inline

Push a value on the queue.

Parameters
valueThe value to push on the queue

◆ wait()

template<typename T >
void gf::Queue< T >::wait ( T value)
inline

Wait for a value from the queue.

Parameters
valueA reference for the result