Moonpool.ChanChannels.
Channels are pipelines of values where threads can push into one end, and pull from the other end.
Unlike Moonpool.Blocking_queue, channels are designed so that pushing never blocks, and pop'ing values returns a future.
type 'a or_error = 'a Fut.or_errorval create : unit -> 'a tCreate a channel.
val push : 'a t -> 'a -> unitpush chan x pushes x into chan. This does not block.
Pop an element. This returns a future that will be fulfilled when an element is available.
val try_pop : 'a t -> 'a optiontry_pop chan pops and return an element if one is available immediately. Otherwise it returns None.
val pop_block_exn : 'a t -> 'aLike pop, but blocks if an element is not available immediately. The precautions around blocking from inside a thread pool are the same as explained in Fut.wait_block.
val close : _ t -> unitClose the channel. Further push and pop calls will fail. This is idempotent.