28using std::size_t, std::span;
29static_assert(std::atomic_size_t::is_always_lock_free,
"rtchan is not useful without lock-free atomic_size_t!");
57 virtual auto try_send(T&& item)
noexcept ->
bool = 0;
62 virtual auto try_send(span<const T>&& items)
noexcept -> span<const T> = 0;
67 virtual void send(T&& item)
noexcept = 0;
72 virtual void send(span<const T>&& items)
noexcept = 0;
77 virtual auto try_recv(T& dest)
noexcept ->
bool = 0;
82 virtual auto try_recv(span<T>& dest)
noexcept -> span<T> = 0;
87 virtual void recv(T& dest)
noexcept = 0;
92 virtual void recv(span<T>& dest)
noexcept = 0;
126 virtual void commit_send(span<const T>& reservation)
noexcept = 0;
158 virtual void commit_recv(span<const T>& reservation)
noexcept = 0;
Abstract common interface for all queues.
Definition rtchan.hpp:52
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_send(T &&item) noexcept -> bool=0
Tries to send item over the channel, aborting if there is not enough room.
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 ...
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,...
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_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 unt...
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 s...
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...
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 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 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 re...
virtual void send(T &&item) noexcept=0
Sends item over the channel. If the channel is full, this function will block until space is availabl...
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 ...
virtual auto try_recv(T &dest) noexcept -> bool=0
Tries to receive an item from the channel, placing it into dest.
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 b...
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_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.