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.
Public Member Functions | |
| ChannelHandle (const ChannelHandle &other) | |
| ChannelHandle & | operator= (const ChannelHandle &other) |
| ChannelHandle (ChannelHandle &&other) noexcept | |
| ChannelHandle & | operator= (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) | |
|
inline |
Forces the channel to close, even if there are still active senders or receivers.
|
inline |
Creates a new receiver for the channel, increasing the active receiver count. Cannot be called following Release.
|
inline |
Creates a new sender for the channel, increasing the active sender count. Cannot be called following 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).