package devkit

  1. Overview
  2. Docs

Variable shared between threads

type 'a t
val create : unit -> 'a t

Create

val set : 'a t -> 'a -> unit

Set the variable (overwriting previous value if any) and return immediately

val clear : 'a t -> unit

Unset the variable

val get : 'a t -> 'a

Get value (block until it is available)

val grab : 'a t -> 'a

Get value (block until it is available) and unset

val try_get : 'a t -> 'a option

Get value immediately without blocking

  • returns

    None if value was not set

val try_grab : 'a t -> 'a option

Grab value immediately without blocking

  • returns

    None if value was not set

OCaml

Innovation. Community. Security.