BlockingQueue< C > Class Template Reference

A queue to put and get (blocking) items. More...

#include <blockingqueue_decls.h>

List of all members.

Public Member Functions

 BlockingQueue ()
 BlockingQueue constructor.
bool isempty () const
 
Returns:
true if the queue is empty

void put (const C &item)
 Puts the given item in the queue.
get ()
 Gets an item from the queue.


Detailed Description

template<class C>
class BlockingQueue< C >

A queue to put and get (blocking) items.

Items can be put using .put(item) which is nonblocking. They can be taken out with blockingly with .get() if the queue is empty (when .isempty() returns true). It will return when another thread .put()s an item.


Member Function Documentation

template<class C>
void BlockingQueue< C >::put ( const C &  item  )  [inline]

Puts the given item in the queue.

This will use the item's copy operator at least once. The operation is nonblocking.

Parameters:
item is the item to be put.

template<class C>
C BlockingQueue< C >::get (  )  [inline]

Gets an item from the queue.

If the queue is empty, this operation will block the current thread until another thread put()s an item in the queue. If another thread also waits to get() something one of them will get the object being put(). Which one of the waiting thread actually gets the object is unspecified.

Returns:
the item that was on top of the queue


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 01:26:51 2009 by  doxygen 1.5.1