Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::Channel< T, P, C > Class Template Reference

Represents a go-like channel, a multi-producer (Sender) multi-consumer (Receiver) thread-safe data pipe. More...

#include <Channel.hpp>

Classes

class  Sender
 The sending end of a channel. More...
class  Receiver
 The receiving end of a channel. More...

Static Public Member Functions

static std::pair< Sender, Receivercreate (auto &&context, std::size_t capacity)
 Factory function to create channel components.

Detailed Description

template<typename T, ProducerType P = ProducerType::Multi, ConsumerType C = ConsumerType::Multi>
class util::Channel< T, P, C >

Represents a go-like channel, a multi-producer (Sender) multi-consumer (Receiver) thread-safe data pipe.

Note
Use INSTANTIATE_CHANNEL_FOR_CLANG macro when using this class. See docs at the bottom of the file for more details.
Template Parameters
TThe type of data the channel transfers
PProducerType::Multi (default) for multi-producer or ProducerType::Single for single-producer
CConsumerType::Multi (default) for multi-consumer or ConsumerType::Single for single-consumer

Member Function Documentation

◆ create()

template<typename T, ProducerType P = ProducerType::Multi, ConsumerType C = ConsumerType::Multi>
std::pair< Sender, Receiver > util::Channel< T, P, C >::create ( auto && context,
std::size_t capacity )
inlinestatic

Factory function to create channel components.

Parameters
contextA supported context type (either io_context or thread_pool)
capacitySize of the internal buffer on the channel
Returns
A pair of Sender and Receiver

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