Interface Functions Detail
void appendValue(queue, val[, expandTag[, parallelTag]);
Enqueue a value to a queue.
Parameters
queue
|
A queue. |
val
|
The value to enqueue. |
expandTag
|
The overflow strategy. If Generous the queue will be
automatically resized if the capacity is exceeded, otherwise the thread spinlocks until
the element can be enqueued.
Default is the DefaultOverflowImplicit result for the queue type. |
parallelTag
|
The concurrency scheme. If multiple threads enqueue values concurrently this tag must be
Parallel. The more efficient Serial tag can only be used if one thread calls appendValue at a time.
Default is Parallel. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
TSize capacity(queue);
Returns the capacity of a queue.
Parameters
queue
|
The queue to query for its capacity. |
Returns
TSize |
Returns the capacity of the queue. |
The capacity is the number of elements that can be enqueued at the same time without reallocating memory.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool empty(queue);
Returns whether a queue is empty.
Parameters
queue
|
The queue to query. |
Returns
bool |
Whether or not the queue is empty. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
TSize length(queue);
Returns the size of a queue.
Parameters
queue
|
The queue to query for its size. |
Returns
TSize |
The number of elements in the queue. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void lockReading(queue);
Parameters
queue
|
The queue to register a reader at. |
The destructor of the queue will spinlock until all readers are deregistered.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void lockWriting(queue);
Parameters
queue
|
The queue to register a writer at. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool popFront(result, queue[, parallelTag]);
Dequeue a value from a queue.
Parameters
queue
|
A queue. |
result
|
The dequeued value. If the queue is empty but writers are available the thread spinlocks
until a value becomes available. |
parallelTag
|
The concurrency scheme. If multiple threads dequeue values concurrently this tag must be
Parallel. The more efficient Serial tag can only be used if one thread calls popFront at a time.
Default is Parallel. |
Returns
bool |
Returns true if a value could be dequeued or false if no writer is
available, see waitForWriters. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
TValue popFront(queue[, parallelTag]);
Dequeue a value from a queue.
Parameters
queue
|
A queue. |
parallelTag
|
The concurrency scheme. If multiple threads dequeue values concurrently this tag must be
Parallel. The more efficient Serial tag can only be used if one thread calls popFront at a time.
Default is Parallel. |
Returns
TValue |
The dequeued value. If the queue is empty the thread spinlocks until a value becomes
available. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool tryPopFront(result, queue[, parallelTag]);
Try to dequeue a value from a queue.
Parameters
queue
|
A queue. |
result
|
The dequeued value (if available). |
parallelTag
|
The concurrency scheme. If multiple threads dequeue values concurrently this tag must be
Parallel. The more efficient Serial tag can only be used if one thread calls popFront at a time.
Default is Parallel. |
Returns
bool |
Returns true if a value could be dequeued and false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void unlockReading(queue);
Parameters
queue
|
The queue to deregister a reader from. |
The destructor of the queue will spinlock until all readers are deregistered.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void unlockWriting(queue);
Parameters
queue
|
The queue to deregister a writer from. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void waitForFirstValue(queue);
Wait for writers to enqueue the first value.
Parameters
If the values are dequeued with popFront2,
this function is a barrier for all readers to wait until all writers are set up completely and should be called
before calling popFront2 the first time.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void waitForWriters(queue, writerCount);
Wait for writers to register.
Parameters
queue
|
A queue. |
writerCount
|
The minimal required number of registered writers, see lockWriting. |
If the values are dequeued with popFront2,
this function is a barrier for all writers to set up completely and should be called before calling appendValue the first time.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.