Gamedev Framework (gf)  0.3.0
A C++11 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 push (const 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

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

Clear the queue.

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
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