File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments