X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2FLogicExecuter.java;h=a7f8c83144d639c0c9f329c5e1cc4867f3fad149;hb=7908fec28b61e5911bf6523a3c10cd3a31dc95e6;hp=52adeba0b44968fced83828086fcb2681171de1a;hpb=2d1f3e4780616f3b638133a243fcdb7a6738baf9;p=Mograsim.git diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java index 52adeba0..a7f8c831 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java @@ -67,7 +67,7 @@ public class LogicExecuter } } catch (@SuppressWarnings("unused") InterruptedException e) - {// do nothing; it is normal execution flow to be interrupted + { // do nothing; it is normal execution flow to be interrupted } } } @@ -83,8 +83,11 @@ public class LogicExecuter timeline.addEventAddedListener(event -> { if (isRunningLive.get()) - if (Timeline.timeCmp(event.getTiming(), nextExecSimulTime.get()) < 0) + { + long nextExecSimulTime = this.nextExecSimulTime.get(); + if (nextExecSimulTime == -1 || Timeline.timeCmp(event.getTiming(), nextExecSimulTime) < 0) simulationThread.interrupt(); + } }); // not optimal; but we don't expect this to happen very often tf.addSimulTimeToRealTimeFactorChangedListener(d -> simulationThread.interrupt());