A channel is a sender and receiver pair that allows one component to send values to another. A sender and receiver pair is similar to an AsyncPipe and AsyncGenerator pair. However, unlike AsyncPipe/AsyncGenerator, senders and receivers can be used by memory‐efficient higher level transformation abstractions.

Synopsis

Declared in <folly/channels/Channel.h>

template<typename TValue>
class Channel;

Description

Typical usage: auto [receiver, sender]= Channel<T>::create(); sender.write(val1); auto val2 = co_await receiver.next();

Static Member Functions

Name

Description

create

Creates a new channel with a sender/receiver pair. The channel will be closed if the sender is destroyed, and will be cancelled if the receiver is destroyed.

Created with MrDocs