Skip to content

Commit deb9630

Browse files
committed
mli for worker loop
1 parent a20208e commit deb9630

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/core/worker_loop_.mli

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
(** Internal module that is used for workers.
2+
3+
A thread pool should use this [worker_loop] to run tasks,
4+
handle effects, etc. *)
5+
6+
open Types_
7+
8+
type task_full =
9+
| T_start of {
10+
fiber: fiber;
11+
f: unit -> unit;
12+
}
13+
| T_resume : {
14+
fiber: fiber;
15+
k: unit -> unit;
16+
}
17+
-> task_full
18+
19+
val _dummy_task : task_full
20+
21+
type around_task =
22+
| AT_pair : (Runner.t -> 'a) * (Runner.t -> 'a -> unit) -> around_task
23+
24+
exception No_more_tasks
25+
26+
type 'st ops = {
27+
schedule: 'st -> task_full -> unit;
28+
get_next_task: 'st -> task_full;
29+
get_thread_state: unit -> 'st;
30+
around_task: 'st -> around_task;
31+
on_exn: 'st -> Exn_bt.t -> unit;
32+
runner: 'st -> Runner.t;
33+
before_start: 'st -> unit;
34+
cleanup: 'st -> unit;
35+
}
36+
37+
val worker_loop : block_signals:bool -> ops:'st ops -> 'st -> unit

0 commit comments

Comments
 (0)