Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TQueue< T > Class Template Reference

List of all members.

Detailed Description

template<class T>
class TQueue< T >

A threadsafe queue class much like an STL queue.


Public Types

typedef queue< T >::value_type value_type
 The type of datum stored in the queue.

typedef queue< T >::size_type size_type
 The type used to represent the size of the queue.


Public Methods

 TQueue ()
 Constructor.

bool empty () const
 Returns true if the queue is empty.

size_type size () const
 Returns the number of items in the queue.

value_typefront ()
 Returns the item at the head of the queue (least recently pushed).

const value_typefront () const
 Returns the item at the head of the queue (least recently pushed).

value_typeback ()
 Returns the item at the tail of the queue (most recently pushed).

const value_typeback () const
 Returns the item at the tail of the queue (most recently pushed).

bool push (const value_type &v)
 Adds an item to the back of the queue.

void pop ()
 Removes an item from the front of the queue.

get ()
 Returns and removes an item from the front of the queue.

bool wait (T &out, bool *pending=0)
 Waits for the queue to become non-empty, then atomically retrieves an item from the queue, sets out, and returns true; or returns false if the queue has been closed.

void waiter_pending ()
void close ()
 Closes the queue so all pending and future calls to wait() will return immediately.

void starve ()
 Starves one waiter, causing its "wait" to return false.

bool is_closed ()
 Is the queue closed?

unsigned int count_waiters ()
 Returns the number of waiters on the Thread.

int extra_capacity ()
 Returns the number of threads currently waiting on the queue (or zero if none) minus the number of elements waiting in the queue.


Member Typedef Documentation

template<class T>
typedef queue<T>::size_type TQueue< T >::size_type
 

The type used to represent the size of the queue.

template<class T>
typedef queue<T>::value_type TQueue< T >::value_type
 

The type of datum stored in the queue.


Constructor & Destructor Documentation

template<class T>
TQueue< T >::TQueue  
 

Constructor.


Member Function Documentation

template<class T>
const value_type& TQueue< T >::back   const
 

Returns the item at the tail of the queue (most recently pushed).

template<class T>
value_type& TQueue< T >::back  
 

Returns the item at the tail of the queue (most recently pushed).

template<class T>
void TQueue< T >::close  
 

Closes the queue so all pending and future calls to wait() will return immediately.

template<class T>
unsigned int TQueue< T >::count_waiters  
 

Returns the number of waiters on the Thread.

template<class T>
bool TQueue< T >::empty   const
 

Returns true if the queue is empty.

template<class T>
int TQueue< T >::extra_capacity  
 

Returns the number of threads currently waiting on the queue (or zero if none) minus the number of elements waiting in the queue.

Returns a positive number if there is an "overflow" of waiters, and a negative number if there is an "underflow" of waiters.

template<class T>
const value_type& TQueue< T >::front   const
 

Returns the item at the head of the queue (least recently pushed).

template<class T>
value_type& TQueue< T >::front  
 

Returns the item at the head of the queue (least recently pushed).

template<class T>
T TQueue< T >::get  
 

Returns and removes an item from the front of the queue.

template<class T>
bool TQueue< T >::is_closed  
 

Is the queue closed?

template<class T>
void TQueue< T >::pop  
 

Removes an item from the front of the queue.

template<class T>
bool TQueue< T >::push const value_type   v
 

Adds an item to the back of the queue.

Returns true if the item will be immediately dispatched.

template<class T>
size_type TQueue< T >::size   const
 

Returns the number of items in the queue.

template<class T>
void TQueue< T >::starve  
 

Starves one waiter, causing its "wait" to return false.

template<class T>
bool TQueue< T >::wait T &    out,
bool *    pending = 0
 

Waits for the queue to become non-empty, then atomically retrieves an item from the queue, sets out, and returns true; or returns false if the queue has been closed.

template<class T>
void TQueue< T >::waiter_pending  
 


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:11 2002 for NMSTL