Skip to content

Commit

Permalink
Merge PR #13250: Micro-optimization in Control.check_for_interrupt.
Browse files Browse the repository at this point in the history
Reviewed-by: SkySkimmer
  • Loading branch information
coqbot-app[bot] committed Nov 2, 2020
2 parents dc244ad + f315ebd commit dfdecf2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/control.ml
Expand Up @@ -18,10 +18,12 @@ let enable_thread_delay = ref false

let check_for_interrupt () =
if !interrupt then begin interrupt := false; raise Sys.Break end;
incr steps;
if !enable_thread_delay && !steps = 1000 then begin
Thread.delay 0.001;
steps := 0;
if !enable_thread_delay then begin
incr steps;
if !steps = 1000 then begin
Thread.delay 0.001;
steps := 0;
end
end

(** This function does not work on windows, sigh... *)
Expand Down

0 comments on commit dfdecf2

Please sign in to comment.