package moonpool

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

moonpool-0.9.tbz
sha256=7194610ba86525f05f9cda15c6f28790ab15804e840bc71269f4590d81d8a390
sha512=625092e840589f2fd46ab88cf72714f4b415d8de0d50e46d4c202149ad7d4e38416a2c5f0100addc23781d6000d3951682b22a915af7f0f69d260d7cf4add9de

doc/moonpool.fib/Moonpool_fib/Fls/index.html

Module Moonpool_fib.FlsSource

Fiber-local storage.

This storage is associated to the current fiber, just like thread-local storage is associated with the current thread.

See Moonpool.Task_local_storage for more general information, as this is based on it.

NOTE: it's important to note that, while each fiber has its own storage, spawning a sub-fiber f2 from a fiber f1 will only do a shallow copy of the storage. Values inside f1's storage will be physically shared with f2. It is thus recommended to store only persistent values in the local storage.

include module type of struct include Moonpool.Task_local_storage end
Sourceval create : unit -> 'a t

create () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.

Sourceexception Not_set
Sourceval get_exn : 'a t -> 'a

get k gets the value for the current task for key k. Must be run from inside a task running on a runner.

Sourceval get_opt : 'a t -> 'a option

get_opt k gets the current task's value for key k, or None if not run from inside the task.

Sourceval get : 'a t -> default:'a -> 'a
Sourceval set : 'a t -> 'a -> unit

set k v sets the storage for k to v. Must be run from inside a task running on a runner.

Sourceval with_value : 'a t -> 'a -> (unit -> 'b) -> 'b

with_value k v f sets k to v for the duration of the call to f(). When f() returns (or fails), k is restored to its old value.

Local Hmap.t

This requires hmap to be installed.