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

Overview

template<typename T>
class pw::async2::internal::ChannelHandle< T >

A handle to a channel, used to create senders and receivers.

After all desired senders and receivers are created, the handle should be released. The channel will remain allocated and open as long as at least one sender and one receiver are alive.

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

Public Member Functions

 ChannelHandle (const ChannelHandle &other)
 
ChannelHandleoperator= (const ChannelHandle &other)
 
 ChannelHandle (ChannelHandle &&other) noexcept
 
ChannelHandleoperator= (ChannelHandle &&other) noexcept
 
bool is_open () const
 
Sender< T > CreateSender ()
 
Receiver< T > CreateReceiver ()
 
void Close ()
 
void Release ()
 

Protected Member Functions

 ChannelHandle (internal::Channel< T > *channel)
 

Member Function Documentation

◆ Close()

template<typename T >
void pw::async2::internal::ChannelHandle< T >::Close ( )
inline

Forces the channel to close, even if there are still active senders or receivers.

◆ CreateReceiver()

template<typename T >
Receiver< T > pw::async2::internal::ChannelHandle< T >::CreateReceiver ( )
inline

Creates a new receiver for the channel, increasing the active receiver count. Cannot be called following Release.

◆ CreateSender()

template<typename T >
Sender< T > pw::async2::internal::ChannelHandle< T >::CreateSender ( )
inline

Creates a new sender for the channel, increasing the active sender count. Cannot be called following Release.

◆ Release()

template<typename T >
void pw::async2::internal::ChannelHandle< T >::Release ( )
inline

Drops the handle to the channel, preventing creation of new senders and receivers.

This function should always be called when the handle is no longer needed. Holding onto an unreleased handle can prevent the channel from being closed (and deallocated if the channel is dynamic).


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