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

Overview

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

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

Inheritance diagram for pw::async2::MpscChannelHandle< T >:
pw::async2::ChannelHandle< T > pw::async2::internal::BaseChannelHandle

Friends

template<typename U >
std::optional< std::tuple< MpscChannelHandle< U >, Receiver< U > > > CreateMpscChannel (Allocator &, uint16_t)
 
template<typename U , uint16_t kCapacity>
std::tuple< MpscChannelHandle< U >, Receiver< U > > CreateMpscChannel (ChannelStorage< U, kCapacity > &storage)
 

Additional Inherited Members

- Public Member Functions inherited from pw::async2::ChannelHandle< T >
 ChannelHandle (const ChannelHandle &)=default
 
ChannelHandleoperator= (const ChannelHandle &)=default
 
 ChannelHandle (ChannelHandle &&)=default
 
ChannelHandleoperator= (ChannelHandle &&)=default
 
- Public Member Functions inherited from pw::async2::internal::BaseChannelHandle
 BaseChannelHandle (const BaseChannelHandle &other)
 
bool is_open () const
 
void Close ()
 
void Release ()
 
- Protected Member Functions inherited from pw::async2::ChannelHandle< T >
 ChannelHandle (internal::Channel< T > &channel)
 
Sender< T > CreateSender ()
 
Receiver< T > CreateReceiver ()
 
- Protected Member Functions inherited from pw::async2::internal::BaseChannelHandle
 BaseChannelHandle (BaseChannel &channel)
 
BaseChannelHandleoperator= (const BaseChannelHandle &other)
 
 BaseChannelHandle (BaseChannelHandle &&other) noexcept
 
BaseChannelHandleoperator= (BaseChannelHandle &&other) noexcept
 
constexpr BaseChannelchannel () const PW_LOCK_RETURNED(channel_)
 

Friends And Related Function Documentation

◆ CreateMpscChannel

template<typename T >
template<typename U >
std::optional< std::tuple< MpscChannelHandle< U >, Receiver< U > > > CreateMpscChannel ( Allocator alloc,
uint16_t  capacity 
)
friend

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

Returns a handle to the channel which may be used to create senders. After all desired senders 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: