package miou

  1. Overview
  2. Docs
Composable concurrency primitives for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

miou-0.10.1.tbz
sha256=56ea30ffd0924d941c8afdb96749252cc4af61465d392178c70475a7859284d5
sha512=42edbb87b4f9c3a0e67e85aebf037e8b6835eae7c8731a7e5caeb6d17be488137bc3bd5c4a375cd03f8eeac2f9d71e24ff0706b9877cc1dc6132666db1fa31d2

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 | _ -> ()