Tanoda
|
Public Member Functions | |
ProduceConsumeBuffer (int minCapacity) | |
Constructs a new produce consumer buffer of at least a certain capacity. Once the buffer is created, the capacity cannot be modified. More... | |
bool | TryEnqueue (ref T t) |
Tries to enqueue a value into the buffer. If the buffer is already full, this method will perform no action and return false. This method is only safe to be called from a single producer thread. More... | |
bool | TryEnqueue (T t) |
Tries to enqueue a value into the buffer. If the buffer is already full, this method will perform no action and return false. This method is only safe to be called from a single producer thread. More... | |
bool | TryPeek (out T t) |
Tries to get the next element that would be dequeued from this buffer. If there is no element yet, this method will return false. If there is an element ready to be dequeued, it will be copied to the out param and this method will return true. More... | |
bool | TryDequeue (out T t) |
Tries to dequeue a value off of the buffer. If the buffer is empty this method will perform no action and return false. This method is only safe to be called from a single consumer thread. More... | |
bool | TryDequeue () |
Tries to dequeue a value off of the buffer. If the buffer is empty this method will perform no action and return false. This method is only safe to be called from a single consumer thread. More... | |
bool | TryDequeueAll (out T mostRecent) |
Tries to dequeue all values off of the buffer, returning the most recently added element. If there was an element found, this method will return true, else it will return false. More... | |
Properties | |
int | Capacity [get] |
Returns the maximum number of elements that the buffer can hold. More... | |
int | Count [get] |
Returns the current number of elements that are held inside the buffer. More... | |
Definition at line 14 of file ProduceConsumeBuffer.cs.
Leap.Unity.ProduceConsumeBuffer< T >.ProduceConsumeBuffer | ( | int | minCapacity | ) |
Constructs a new produce consumer buffer of at least a certain capacity. Once the buffer is created, the capacity cannot be modified.
If the minimum capacity is a power of two, it will be used as the actual capacity. If the minimum capacity is not a power of two, the next highest power of two will be used as the capacity. This behavior is an optimization, Internally this class uses a bitwise AND operation instead of a slower modulus operation for indexing, which only is possible if the array length is a power of two.
Definition at line 31 of file ProduceConsumeBuffer.cs.
bool Leap.Unity.ProduceConsumeBuffer< T >.TryDequeue | ( | ) |
Tries to dequeue a value off of the buffer. If the buffer is empty this method will perform no action and return false. This method is only safe to be called from a single consumer thread.
Definition at line 146 of file ProduceConsumeBuffer.cs.
bool Leap.Unity.ProduceConsumeBuffer< T >.TryDequeue | ( | out T | t | ) |
Tries to dequeue a value off of the buffer. If the buffer is empty this method will perform no action and return false. This method is only safe to be called from a single consumer thread.
Definition at line 130 of file ProduceConsumeBuffer.cs.
bool Leap.Unity.ProduceConsumeBuffer< T >.TryDequeueAll | ( | out T | mostRecent | ) |
Tries to dequeue all values off of the buffer, returning the most recently added element. If there was an element found, this method will return true, else it will return false.
Definition at line 160 of file ProduceConsumeBuffer.cs.
bool Leap.Unity.ProduceConsumeBuffer< T >.TryEnqueue | ( | ref T | t | ) |
Tries to enqueue a value into the buffer. If the buffer is already full, this method will perform no action and return false. This method is only safe to be called from a single producer thread.
Definition at line 86 of file ProduceConsumeBuffer.cs.
bool Leap.Unity.ProduceConsumeBuffer< T >.TryEnqueue | ( | T | t | ) |
Tries to enqueue a value into the buffer. If the buffer is already full, this method will perform no action and return false. This method is only safe to be called from a single producer thread.
Definition at line 100 of file ProduceConsumeBuffer.cs.
bool Leap.Unity.ProduceConsumeBuffer< T >.TryPeek | ( | out T | t | ) |
Tries to get the next element that would be dequeued from this buffer. If there is no element yet, this method will return false. If there is an element ready to be dequeued, it will be copied to the out param and this method will return true.
This method is only safe to be called from a single consumer thread.
Definition at line 112 of file ProduceConsumeBuffer.cs.
|
get |
Returns the maximum number of elements that the buffer can hold.
Definition at line 59 of file ProduceConsumeBuffer.cs.
|
get |
Returns the current number of elements that are held inside the buffer.
Definition at line 68 of file ProduceConsumeBuffer.cs.