Halyri - Udp-client  0.9.1
 All Classes Namespaces Functions Enumerations Properties
BlockingQueue< T > Class Template Reference

Thread-safe blocking queue that has a defined, finite length. More...

Public Member Functions

 BlockingQueue ()
 Initializes a new blocking queue that has the default length of 30 elements. More...
 
 BlockingQueue (int capacity)
 Initializes a blocking queue with the specified length. More...
 
void Enqueue (T element)
 Enqueues the element. If the queue is full, the operation will block until free space becomes available. More...
 
bool Offer (T element)
 Tries to enqueue the element. If operation succeeds without blocking, returns true. Otherwise return false. More...
 
Dequeue ()
 Dequeues and returns the last element from the end of the queue. This opeartion will block if the queue is empty. More...
 
bool Peek (out T element)
 Tries to dequeue the last element from the end of the queue. If operation succeeds without blocking, returns true. Otherwise returns false. More...
 
int Count ()
 Gets the count of elements in the queue. More...
 

Detailed Description

Thread-safe blocking queue that has a defined, finite length.

<author>Veli-Mikko Puupponen</author>

Template Parameters
TType of the elements in the queue

Constructor & Destructor Documentation

BlockingQueue ( )

Initializes a new blocking queue that has the default length of 30 elements.

BlockingQueue ( int  capacity)

Initializes a blocking queue with the specified length.

Parameters
capacityLength of the queue

Member Function Documentation

int Count ( )

Gets the count of elements in the queue.

Returns
Number of elements in this queue
T Dequeue ( )

Dequeues and returns the last element from the end of the queue. This opeartion will block if the queue is empty.

Returns
The last element in the queue
void Enqueue ( element)

Enqueues the element. If the queue is full, the operation will block until free space becomes available.

Parameters
elementElement to enqueue
bool Offer ( element)

Tries to enqueue the element. If operation succeeds without blocking, returns true. Otherwise return false.

Parameters
elementElement to enqueue
Returns
True, if the element was successfully enqueued, otherwise false
bool Peek ( out T  element)

Tries to dequeue the last element from the end of the queue. If operation succeeds without blocking, returns true. Otherwise returns false.

Parameters
elementThe last element in the queue
Returns
True, if the opeation succeeds, otherwise false

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