Debian Codegraph @

stm/workerPool.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 type worker_id = string
12
13 type 'a cpanel = {
14 exit : unit -> unit; (* called by manager to exit instead of Thread.exit *)
15 cancelled : unit -> bool; (* manager checks for a request of termination *)
16 extra : 'a; (* extra stuff to pass to the manager *)
17 }
18
19 module type PoolModel = sig
20 (* this shall come from a Spawn.* model *)
21 type process
22 val spawn : spawn_args:string list -> int -> CoqworkmgrApi.priority ->
23 worker_id * process * CThread.thread_ic * out_channel
24
25 (* this defines the main loop of the manager *)
26 type extra
27 val manager :
28 extra cpanel -> worker_id * process * CThread.thread_ic * out_channel -> unit
29 end
30
31 module Make(Model : PoolModel) : sig
32
33 type pool
34
35 val create : spawn_args:string list -> Model.extra -> size:int -> CoqworkmgrApi.priority -> pool
36
37 val is_empty : pool -> bool
38 val n_workers : pool -> int
39
40 (* cancel signal *)
41 val cancel : worker_id -> pool -> unit
42 val cancel_all : pool -> unit
43 (* camcel signal + true removal, the pool is empty afterward *)
44 val destroy : pool -> unit
45
46 (* The worker should call this function *)
47 val worker_handshake : CThread.thread_ic -> out_channel -> unit
48
49 end