package moonpool

  1. Overview
  2. Docs
Pools of threads supported by a pool of domains

Install

Dune Dependency

Authors

Maintainers

Sources

moonpool-0.7.tbz
sha256=c4a1f974200530ab7f6014de3a369fdbb260ff454183640f32e51ba3fec51b15
sha512=865daabb96e3d60f88ecee9fc9030dad8b257fff4121b404e882d8a8d6687b737beb6e22366f52eb14e770dfab28b326853a1d3d883fa19bbd791d8450b40f8b

doc/moonpool/Moonpool/Chan/index.html

Module Moonpool.ChanSource

Channels.

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.

  • since 0.3
Sourcetype 'a or_error = 'a Fut.or_error
Sourcetype 'a t

Channel carrying values of type 'a.

Sourceval create : unit -> 'a t

Create a channel.

Sourceexception Closed
Sourceval push : 'a t -> 'a -> unit

push chan x pushes x into chan. This does not block.

  • raises Closed

    if the channel is closed.

Sourceval pop : 'a t -> 'a Fut.t

Pop an element. This returns a future that will be fulfilled when an element is available.

  • raises Closed

    if the channel is closed, or fails the future if the channel is closed before an element is available for it.

Sourceval try_pop : 'a t -> 'a option

try_pop chan pops and return an element if one is available immediately. Otherwise it returns None.

Sourceval pop_block_exn : 'a t -> 'a

Like 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.

Sourceval close : _ t -> unit

Close the channel. Further push and pop calls will fail. This is idempotent.

Sourceval pop_await : 'a t -> 'a

Like pop but suspends the current thread until an element is available. See Await for more details.

  • since 0.3
OCaml

Innovation. Community. Security.