Boost.Cobalt channels
In Boost.Cobalt, channels provide a way for coroutines to communicate asynchronously, allowing data transfer between a producer and a consumer coroutine in a safe and efficient manner. They are inspired by Golang channels and allow communication through message passing, promoting a share-memory-by-communicating paradigm.
A channel is a mechanism through which values are asynchronously passed from one coroutine (the producer) to another (the consumer). This communication is non-blocking, which means that coroutines can suspend their execution when they wait for data to be available on the channel or when they write data to a channel that has limited capacity. Let’s clarify this: both reading and writing operations may be blocking, depending on the buffer size if, by blocking, we mean coroutines are suspended, but on the other hand, from the point of view of threads, these operations don’t block the thread.
If the buffer size is zero, a read...