aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2020-10-22 17:25:20 +0200
committerPierre-Marie Pédrot2020-10-22 17:25:20 +0200
commitf315ebdd5c7a30284c67e47273eb784dd19b3879 (patch)
treefa4cd40d9fbd464b5f75f9d76e9fe0676fa6cbfa
parentfe095cd8b63e363e82953503cb84a851296c1965 (diff)
Micro-optimization in Control.check_for_interrupt.
We do not have to increase the step counter when out of the threaded mode since this counter is only relevant when in that mode.
-rw-r--r--lib/control.ml10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/control.ml b/lib/control.ml
index bb42b5727e..95ea3935a7 100644
--- a/lib/control.ml
+++ b/lib/control.ml
@@ -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... *)