BoundedBuffer has a limited capacity.
Trying to Add an element to a full buffer will make the calling thread wait. This class is thread safe.
More...
Inherits producerConsumer.AbstractBuffer.
|
| BoundedBuffer (int capacity) |
| Constructs a new BoundedBuffer object More...
|
|
Boolean | IsFull () |
| Returns true if the buffer is full, false otherwise More...
|
|
override void | Add (int element) |
| Adds an element into the end of this buffer.
If the buffer is full, the calling thread will wait until another thread has taken an element from the buffer More...
|
|
override int | Take () |
| Removes and returns the first element from this buffer.
If the buffer is empty, the thread calling Tak() must wait until another thread Puts an element. More...
|
|
Boolean | IsEmpty () |
| Returns true if the buffer is empty, false otherwise More...
|
|
|
readonly Queue< int > | Queue = new Queue<int>() |
|
BoundedBuffer has a limited capacity.
Trying to Add an element to a full buffer will make the calling thread wait. This class is thread safe.
producerConsumer.BoundedBuffer.BoundedBuffer |
( |
int |
capacity | ) |
|
Constructs a new BoundedBuffer object
- Parameters
-
- Exceptions
-
ArgumentOutOfRangeException | If the capacity is less than or equal to zero |
override void producerConsumer.BoundedBuffer.Add |
( |
int |
element | ) |
|
|
virtual |
Adds an element into the end of this buffer.
If the buffer is full, the calling thread will wait until another thread has taken an element from the buffer
- Parameters
-
element | new element to be added into this buffer |
Implements producerConsumer.AbstractBuffer.
Boolean producerConsumer.BoundedBuffer.IsFull |
( |
| ) |
|
Returns true if the buffer is full, false otherwise
- Returns
- true if the buffer is full, false otherwise
override int producerConsumer.BoundedBuffer.Take |
( |
| ) |
|
|
virtual |
Removes and returns the first element from this buffer.
If the buffer is empty, the thread calling Tak() must wait until another thread Puts an element.
- Returns
- The first element from this buffer
Implements producerConsumer.AbstractBuffer.
int producerConsumer.BoundedBuffer.Capacity |
|
get |
The documentation for this class was generated from the following file:
- C:/andersb/sodpcs/concurrency/producerConsumer/producerConsumer/BoundedBuffer.cs