package riot

  1. Overview
  2. Docs
An actor-model multi-core scheduler for OCaml 5

Install

Dune Dependency

Authors

Maintainers

Sources

riot-0.0.4.tbz
sha256=bd196369f74bbc42f23d262030d5fa04c03f5f00c46bf944f0dcbc193745976f
sha512=f1ca69e05b57e83a1bd173efe51b745d331355a83381e6068743a7626e45dcf515cdd8947180051bddfe9f5727c2732aa0f01a093b04cf33fa4081d32f24fd65

doc/src/riot.util/thread_local.ml.html

Source file thread_local.ml

1
2
3
4
5
6
7
8
9
10
11
12
exception Uninitialized_thread_local of string

let make ~name =
  let value = Atomic.make None in
  let key = Domain.DLS.new_key (fun () -> Atomic.get value) in
  let get () =
    match Domain.DLS.get key with
    | Some x -> x
    | None -> raise (Uninitialized_thread_local name)
  in
  let set x = Domain.DLS.set key (Some x) in
  (get, set)
OCaml

Innovation. Community. Security.