Thread-safe blocking queue that has a defined, finite length.
More...
|
| 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...
|
|
T | 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...
|
|
Thread-safe blocking queue that has a defined, finite length.
<author>Veli-Mikko Puupponen</author>
- Template Parameters
-
T | Type of the elements in the queue |
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
-
capacity | Length of the queue |
Gets the count of elements in the queue.
- Returns
- Number of elements in this queue
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 |
( |
T |
element | ) |
|
Enqueues the element. If the queue is full, the operation will block until free space becomes available.
- Parameters
-
element | Element to enqueue |
Tries to enqueue the element. If operation succeeds without blocking, returns true. Otherwise return false.
- Parameters
-
element | Element 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
-
element | The last element in the queue |
- Returns
- True, if the opeation succeeds, otherwise false
The documentation for this class was generated from the following file: