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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use crate::*;
#[inline(always)]
pub unsafe fn lean_task_spawn(c: lean_obj_arg, prio: lean_obj_arg) -> lean_obj_res {
lean_task_spawn_core(c, lean_unbox(prio) as c_uint, false)
}
#[inline(always)]
pub unsafe fn lean_task_bind(x: lean_obj_arg, f: lean_obj_arg, prio: lean_obj_arg) -> lean_obj_res {
lean_task_bind_core(x, f, lean_unbox(prio) as c_uint, false)
}
#[inline(always)]
pub unsafe fn lean_task_map(f: lean_obj_arg, t: lean_obj_arg, prio: lean_obj_arg) -> lean_obj_res {
lean_task_map_core(f, t, lean_unbox(prio) as c_uint, false)
}
#[inline]
pub unsafe fn lean_task_get_own(t: b_lean_obj_arg) -> lean_obj_res {
let r = lean_task_get(t);
lean_inc(r);
lean_dec(t);
r
}
#[link(name = "leanshared")]
extern "C" {
pub fn lean_init_task_manager();
pub fn lean_init_task_manager_using(num_workers: c_uint);
pub fn lean_finalize_task_manager();
pub fn lean_task_spawn_core(c: lean_obj_arg, prio: c_uint, keep_alive: bool) -> lean_obj_res;
pub fn lean_task_pure(a: lean_obj_arg) -> lean_obj_res;
pub fn lean_task_bind_core(
x: lean_obj_arg,
f: lean_obj_arg,
prio: c_uint,
keep_alive: bool,
) -> lean_obj_res;
pub fn lean_task_map_core(
f: lean_obj_arg,
t: lean_obj_arg,
prio: c_uint,
keep_alive: bool,
) -> lean_obj_res;
pub fn lean_task_get(t: b_lean_obj_arg) -> lean_obj_res;
pub fn lean_io_check_canceled_core() -> bool;
pub fn lean_io_cancel_core(t: b_lean_obj_arg);
pub fn lean_io_has_finished_core(t: b_lean_obj_arg) -> bool;
pub fn lean_io_wait_any_core(task_list: b_lean_obj_arg) -> b_lean_obj_res;
}