Repository navigation
Expand file tree
/
Copy pathmultiThreadedCall.mli
More file actions
68 lines (57 loc) · 1.86 KB
/
Copy pathmultiThreadedCall.mli
File metadata and controls
68 lines (57 loc) · 1.86 KB
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
61
62
63
64
65
66
67
68
(**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the "hack" directory of this source tree.
*
*)
(** If a worker process fails, this is raised.
*
* Note: When one worker process fails, the remaining in-progress workers are checked
* for completion/failure, and all their failures (non-zero exit code) are coalesced
* together into one of these exceptions.
*
* No further buckets are distributed to workers.
*
* Still-in-progress workers are left to their own accord. *)
exception Coalesced_failures of (WorkerController.worker_failure list)
val coalesced_failures_to_string:
WorkerController.worker_failure list -> string
type interrupt_result = Cancel | Continue
type 'env interrupt_handler = 'env -> 'env * interrupt_result
type 'env interrupt_config = {
env : 'env;
handlers : 'env -> (Unix.file_descr * 'env interrupt_handler) list;
}
type worker_id = int
val no_interrupt : 'a -> 'a interrupt_config
(** Can raise Coalesced_failures exception. *)
val call :
WorkerController.worker list ->
('c -> 'a -> 'b) ->
('b -> 'c -> 'c) ->
'c ->
'a Bucket.next ->
'c
(** Invokes merge with a unique worker id.
Can raise Coalesced_failures exception. *)
val call_with_worker_id :
WorkerController.worker list ->
('c -> 'a -> 'b) ->
(worker_id * 'b -> 'c -> 'c) ->
'c ->
'a Bucket.next ->
'c
val call_with_interrupt :
WorkerController.worker list ->
('c -> 'a -> 'b) ->
('b -> 'c -> 'c) -> 'c ->
'a Bucket.next ->
(* [on_cancelled] should be specified if your [next] function ever returns
[Bucket.Wait], and it should return the list of all jobs that haven't
finished or started yet. *)
?on_cancelled:(unit -> 'a list) ->
'd interrupt_config ->
'c * 'd * 'a list
val on_exception : ((exn * Utils.callstack) -> unit) -> unit