diff options
| author | Pierre-Marie Pédrot | 2020-10-22 17:25:20 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2020-10-22 17:25:20 +0200 |
| commit | f315ebdd5c7a30284c67e47273eb784dd19b3879 (patch) | |
| tree | fa4cd40d9fbd464b5f75f9d76e9fe0676fa6cbfa /lib | |
| parent | fe095cd8b63e363e82953503cb84a851296c1965 (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.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/control.ml | 10 |
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... *) |
