|
☎️ rtchan
Realtime-safe channels (lock-free queues) for C++20
|
Abstract common interface for all queues. More...
#include <rtchan.hpp>
Public Member Functions | |
| virtual auto | try_send (T &&item) noexcept -> bool=0 |
Tries to send item over the channel, aborting if there is not enough room. | |
| virtual auto | try_send (span< const T > &&items) noexcept -> span< const T >=0 |
Tries to send as many items in items over the channel as will fit. | |
| virtual void | send (T &&item) noexcept=0 |
Sends item over the channel. If the channel is full, this function will block until space is available using a busy-wait loop. | |
| virtual void | send (span< const T > &&items) noexcept=0 |
Sends all items in items over the channel. If the channel cannot fit all of items, this function will block until space is available using a busy-wait loop. | |
| virtual auto | try_recv (T &dest) noexcept -> bool=0 |
Tries to receive an item from the channel, placing it into dest. | |
| virtual auto | try_recv (span< T > &dest) noexcept -> span< T >=0 |
Tries to receive items up to the capacity of dest from the channel into dest. | |
| virtual void | recv (T &dest) noexcept=0 |
Receives an item from the channel into dest. If the channel is empty, this function will block until an item is available using a busy-wait loop. | |
| virtual void | recv (span< T > &dest) noexcept=0 |
Receives items equal to the capacity of dest from the channel into dest. If the channel does not have enough items to fill dest, this function will block until there are enough available items using a busy-wait loop. | |
| virtual auto | try_reserve_send (size_t count) noexcept -> span< T >=0 |
Tries to reserve space for count items in the channel to be manually written into. | |
| virtual auto | reserve_send_up_to (size_t count) noexcept -> span< T >=0 |
Tries to reserve space for up to count items in the channel to be manually written into. | |
| virtual auto | reserve_send (size_t count) noexcept -> span< T >=0 |
Reserves space for count items in the channel to be manually written into. This function may spin until it can return a contiguous span of length count. | |
| virtual auto | try_commit_send (span< const T > &reservation) noexcept -> bool=0 |
Tries to commit the items in reservation, indicating that they are finished being sent and are ready to be received. This function will fail until all previously obtained reservations to reservation have been committed. | |
| virtual void | commit_send (span< const T > &reservation) noexcept=0 |
Commits the items in reservation, indicating that they are finished being sent and are ready to be received. This function may spin until all previously obtained reservations to reservation have been committed. | |
| virtual auto | try_reserve_recv (size_t count) noexcept -> span< T >=0 |
Tries to reserve space for count items in the channel to be manually read from. | |
| virtual auto | reserve_recv_up_to (size_t count) noexcept -> span< T >=0 |
Tries to reserve space for up to count items in the channel to be manually read from. | |
| virtual auto | reserve_recv (size_t count) noexcept -> span< T >=0 |
Reserves space for count items in the channel to be manually read from. | |
| virtual auto | try_commit_recv (span< const T > &reservation) noexcept -> bool=0 |
Tries to release the items in reservation, indicating that they are finished being received and are safe to be overwritten. This function may spin until all previously obtained reservations to reservation have been committed. | |
| virtual void | commit_recv (span< const T > &reservation) noexcept=0 |
Releases the items in reservation, indicating that they are finished being received and are safe to be overwritten. This function may spin until all previously obtained reservations to reservation have been committed. | |
Abstract common interface for all queues.
| T | The type of item or message the queue holds |
| N | The capacity of the queue, must be a power of 2 |
|
pure virtualnoexcept |
Releases the items in reservation, indicating that they are finished being received and are safe to be overwritten. This function may spin until all previously obtained reservations to reservation have been committed.
| reservation | The reservation of items to mark as received |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Commits the items in reservation, indicating that they are finished being sent and are ready to be received. This function may spin until all previously obtained reservations to reservation have been committed.
| reservation | The reservation of items to mark as sent |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Receives items equal to the capacity of dest from the channel into dest. If the channel does not have enough items to fill dest, this function will block until there are enough available items using a busy-wait loop.
| dest | The destination to receive the items into |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Receives an item from the channel into dest. If the channel is empty, this function will block until an item is available using a busy-wait loop.
| dest | The destination to receive the item into |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Reserves space for count items in the channel to be manually read from.
| count | How many items to try to reserve space for |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to reserve space for up to count items in the channel to be manually read from.
| count | How many items to try to reserve space for |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Reserves space for count items in the channel to be manually written into. This function may spin until it can return a contiguous span of length count.
| count | How many items to try to reserve space for |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to reserve space for up to count items in the channel to be manually written into.
| count | How many items to try to reserve space for |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Sends all items in items over the channel. If the channel cannot fit all of items, this function will block until space is available using a busy-wait loop.
| items | The items to send |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Sends item over the channel. If the channel is full, this function will block until space is available using a busy-wait loop.
| item | The item to send |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to release the items in reservation, indicating that they are finished being received and are safe to be overwritten. This function may spin until all previously obtained reservations to reservation have been committed.
| reservation | The reservation of items to mark as received |
reservation was able to be committed or not. Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to commit the items in reservation, indicating that they are finished being sent and are ready to be received. This function will fail until all previously obtained reservations to reservation have been committed.
| reservation | The reservation of items to mark as sent |
reservation was able to be committed or not. Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to receive items up to the capacity of dest from the channel into dest.
| dest | The destination to receive the items into |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to receive an item from the channel, placing it into dest.
| dest | The destination to receive the item into |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to reserve space for count items in the channel to be manually read from.
| count | How many items to try to reserve space for |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to reserve space for count items in the channel to be manually written into.
| count | How many items to try to reserve space for |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to send as many items in items over the channel as will fit.
| items | The items to try to send |
Implemented in rtchan::mpmc< T, N >.
|
pure virtualnoexcept |
Tries to send item over the channel, aborting if there is not enough room.
| item | The item to try to send |
Implemented in rtchan::mpmc< T, N >.