C/C++ API Reference
Loading...
Searching...
No Matches
pw::async2::SpmcChannelHandle< T > Class Template Reference

Overview

template<typename T>
class pw::async2::SpmcChannelHandle< T >

A handle to a single-producer, multi-consumer channel.

Inheritance diagram for pw::async2::SpmcChannelHandle< T >:
pw::async2::internal::ChannelHandle< T >

Friends

template<typename U >
std::optional< std::tuple< SpmcChannelHandle< U >, Sender< U > > > CreateSpmcChannel (Allocator &, uint16_t)
 
template<typename U , uint16_t kCapacity>
std::tuple< SpmcChannelHandle< U >, Sender< U > > CreateSpmcChannel (ChannelStorage< U, kCapacity > &storage)
 

Friends And Related Function Documentation

◆ CreateSpmcChannel

template<typename T >
template<typename U >
std::optional< std::tuple< SpmcChannelHandle< U >, Sender< U > > > CreateSpmcChannel ( Allocator alloc,
uint16_t  capacity 
)
friend

Creates a dynamically allocated single-producer, multi-consumer channel with a fixed storage capacity.

Returns a handle to the channel which may be used to create receivers. After all desired receivers are created, the handle can be dropped without affecting the channel.

All allocation occurs during the creation of the channel. After this function returns, usage of the channel is guaranteed not to allocate. If allocation fails, returns std::nullopt.

The channel remains open as long as at least either a handle, or at least one sender and one receiver exist.


The documentation for this class was generated from the following file: