package riot

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

Install

Dune Dependency

Authors

Maintainers

Sources

riot-0.0.5.tbz
sha256=01b7b82ccc656b12b7315960d9df17eb4682b8f1af68e9fee33171fee1f9cf88
sha512=d8831d8a75fe43a7e8d16d2c0bb7d27f6d975133e17c5dd89ef7e575039c59d27c1ab74fbadcca81ddfbc0c74d1e46c35baba35ef825b36ac6c4e49d7a41d0c2

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.