|
CoreComponents 3.0.0
A Modern C++ Toolkit
|
Prioritized thread communication channel. More...
#include <cc/PriorityChannel>
Public Types | |
| using | Item = T |
| Item type. | |
| using | Priority = P |
| Priority type. | |
Public Member Functions | |
| PriorityChannel ()=default | |
| Create a new channel. | |
| bool | pushBack (const T &item, P priority=0) |
| Add a new item to the end. | |
| bool | popFront (Out< T > item=None{}) |
| Remove an item from the front. | |
| bool | read (Out< T > item) |
| Remove an item from the front. | |
| bool | write (const T &item, P priority=0) |
| Add a new item to the end. | |
| bool | wait () |
| Wait for the channel to become ready to read. | |
| bool | waitUntil (double time) |
| Wait for the channel to become ready to read for a limited time. | |
| bool | popFrontBefore (double time, Out< T > item=None{}) |
| Remove an item from the head of the queue before given time. | |
| long | count () const |
| Get the number of queued items. | |
| void | close () |
| Shutdown communication. | |
| SourceIterator< PriorityChannel > | begin () |
| SourceIterator< PriorityChannel > | end () |
Prioritized thread communication channel.
| T | Item type |
| P | Priority type |
| using Item = T |
Item type.
| using Priority = P |
Priority type.
|
default |
Create a new channel.
| bool pushBack | ( | const T & | item, |
| P | priority = 0 ) |
Add a new item to the end.
| item | Item value |
| priority | Item priority |
Remove an item from the front.
| item | Returns the item value |
| bool read | ( | Out< T > | item | ) |
Remove an item from the front.
| item | Returns the item value |
| bool write | ( | const T & | item, |
| P | priority = 0 ) |
Add a new item to the end.
| item | Item value |
| priority | Item priority |
| bool wait | ( | ) |
Wait for the channel to become ready to read.
| bool waitUntil | ( | double | time | ) |
Wait for the channel to become ready to read for a limited time.
| time | Seconds elapsed since the begin of Epoch |
Remove an item from the head of the queue before given time.
| time | Seconds elapsed since the begin of Epoch |
| item | Returns the item value |
| long count | ( | ) | const |
Get the number of queued items.
| void close | ( | ) |
Shutdown communication.