aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/control.ml
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2014-06-07 17:04:56 +0200
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2014-06-07 17:08:54 +0200
commit560b24f8eab0838fd6e01da8c4373f560020aadd (patch)
tree155efeee777cecabd7d2898da4689075129e43bc /lib/control.ml
parent24a0df63c1844c6f2c69f9644a3059d668fd1e6f (diff)
Moving a Thread.yield in check_interrupt.
Diffstat (limited to 'lib/control.ml')
-rw-r--r--lib/control.ml16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/control.ml b/lib/control.ml
index 9573614fd..8ce3334f5 100644
--- a/lib/control.ml
+++ b/lib/control.ml
@@ -10,8 +10,22 @@
let interrupt = ref false
+let steps = ref 0
+
+let slave_process =
+ let rec f = ref (fun () ->
+ match !Flags.async_proofs_mode with
+ | Flags.APonParallel n -> let b = n > 0 in f := (fun () -> b); !f ()
+ | _ -> f := (fun () -> false); !f ()) in
+ fun () -> !f ()
+
let check_for_interrupt () =
- if !interrupt then begin interrupt := false; raise Sys.Break end
+ if !interrupt then begin interrupt := false; raise Sys.Break end;
+ incr steps;
+ if !steps = 10000 && slave_process () then begin
+ Thread.yield ();
+ steps := 0;
+ end
(** This function does not work on windows, sigh... *)
let unix_timeout n f e =