A handle to a multi-producer, single-consumer channel.
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) |
|
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.