package picos_std

  1. Overview
  2. Docs
Sample libraries for Picos

Install

Dune Dependency

Authors

Maintainers

Sources

picos-0.6.0.tbz
sha256=3f5a08199cf65c2dae2f7d68f3877178f1da8eabf5376e15114e5a8958087dfa
sha512=ad24910c47ce614268c4268874bb918da7f8b5f03b3ad706bbf30323635262e94ddab6be24eaebbca706bfa82c0a517d4272b396459e020c185942125c9bdb7b

doc/src/picos_std.sync/ivar.ml.html

Source file ivar.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
open Picos
open Picos_std_event

type 'a t = 'a Computation.t

let create () = Computation.create ()
let of_value = Computation.returned
let try_fill = Computation.try_return
let fill = Computation.return
let try_poison_at = Computation.try_cancel
let poison_at = Computation.cancel

let peek_opt ivar =
  match Computation.peek_exn ivar with
  | value -> Some value
  | exception Computation.Running -> None

let try_poison ?(callstack = 0) ivar exn =
  try_poison_at ivar exn (Printexc.get_callstack callstack)

let read = Computation.await
let read_evt = Event.from_computation

let[@inline always] poison ?(callstack = 0) ivar exn =
  poison_at ivar exn (Printexc.get_callstack callstack)
OCaml

Innovation. Community. Security.