forked from miking-lang/miking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththread.ext-ocaml.mc
42 lines (35 loc) · 969 Bytes
/
thread.ext-ocaml.mc
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
35
36
37
38
39
40
41
42
include "map.mc"
include "ocaml/ast.mc"
let impl = lam arg : { expr : String, ty : Type }.
{ expr = arg.expr, ty = arg.ty, libraries = [], cLibraries = [] }
let tyathread_ = lam. tyunknown_
let tygeneric_ = lam. tyunknown_
let threadExtMap =
use OCamlTypeAst in
mapFromSeq cmpString
[ ("externalThreadSpawn", [
impl
{ expr = "Domain.spawn"
, ty = tyarrow_ (tyarrow_ otyunit_ (tygeneric_ "a")) (tyathread_ "a")
}]),
("externalThreadJoin", [
impl
{ expr = "Domain.join"
, ty = tyarrow_ (tyathread_ "a") (tygeneric_ "a")
}]),
("externalThreadGetID", [
impl
{ expr = "Domain.get_id"
, ty = tyarrow_ (tyathread_ "a") tyint_
}]),
("externalThreadSelf", [
impl
{ expr = "Domain.self"
, ty = tyarrow_ otyunit_ tyint_
}]),
("externalThreadCPURelax", [
impl
{ expr = "Domain.cpu_relax"
, ty = tyarrow_ otyunit_ otyunit_
}])
]