package miou

  1. Overview
  2. Docs
Composable concurrency primitives for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

miou-0.8.0.tbz
sha256=8cc05f77a23680a52a3008d461afed3b210c29c6cccdacd113232c41bab789fa
sha512=61bc945b1c8c15e65b927cae6837d18988d296f5797012acae5d245cc86be41c6fc3cf88ebe82670181acaaa1ed3f3b0648af63f8c768952bf4d834e5fa92bc2

doc/src/miou/miou_trace.ml.html

Source file miou_trace.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
26
27
28
29
30
31
32
33
34
type event = ..

type event +=
  | Spawn of {
        uid: int
      ; parent: int
      ; runner: int
      ; kind: [ `Async | `Parallel ]
    }
  | Spawn_location of { uid: int; filename: string; line: int }
  | Cancel of int
  | Cancelled of int
  | Await of int
  | Resume of int
  | Yield of int
  | Suspend of { name: string; uid: int }
  | Continue of { name: string; uid: int }
  | Attach of { ruid: int; puid: int }
  | Detach of { ruid: int; puid: int }
  | Run_begin of int
  | Run_end of int
  | Run_done of int
  | Clean of { self: int; child: int }
  | Still_has_children of int
  | Not_a_child of { self: int; prm: int }
  | Resource_leaked of int
  | Not_owner of { ruid: int; puid: int }

let reporter : (event -> unit) Atomic.t = Atomic.make ignore
let set_reporter fn = Atomic.set reporter fn
let miou_trace = Sys.getenv_opt "MIOU_TRACE"

let trace event =
  match miou_trace with Some _ -> (Atomic.get reporter) event | _ -> ()