@ -7,11 +7,10 @@
* of patent rights can be found in the PATENTS file in the same directory .
* of patent rights can be found in the PATENTS file in the same directory .
* )
* )
open ! IStd
open ! IStd
module L = Logging
type t = { mutable num_processes : int ; jobs : int }
type t = { mutable num_processes : int ; jobs : int }
exception Execution_error of string
let create ~ jobs = { num_processes = 0 ; jobs }
let create ~ jobs = { num_processes = 0 ; jobs }
let incr counter = counter . num_processes <- counter . num_processes + 1
let incr counter = counter . num_processes <- counter . num_processes + 1
@ -22,11 +21,10 @@ let wait counter =
match Unix . wait ` Any with
match Unix . wait ` Any with
| _ , Ok _ ->
| _ , Ok _ ->
decr counter
decr counter
| _ , Error _ when Config . keep_going ->
(* Proceed past the failure when keep going mode is on *)
decr counter
| _ , ( Error _ as status ) ->
| _ , ( Error _ as status ) ->
raise ( Execution_error ( Unix . Exit_or_signal . to_string_hum status ) )
let log_or_die = if Config . keep_going then L . internal_error else L . die InternalError in
log_or_die " Error in infer subprocess: %s@. " ( Unix . Exit_or_signal . to_string_hum status ) ;
decr counter
let wait_all counter = for _ = 1 to counter . num_processes do wait counter done
let wait_all counter = for _ = 1 to counter . num_processes do wait counter done