From: Reino Ruusu Date: Wed, 26 Sep 2018 10:58:58 +0000 (+0300) Subject: Fixed race condition in DynamicExperimentThread. X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F2248%2F1;p=simantics%2Fplatform.git Fixed race condition in DynamicExperimentThread. gitlab #136 Change-Id: I533e274bef62e7ce939c9a67a37d8e86d6f38bce (cherry picked from commit 1b6efbcb17b7cf648145f83b1a82f6e1c1dce22e) --- diff --git a/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java b/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java index 66cec38a4..836c7920f 100644 --- a/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java +++ b/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java @@ -151,9 +151,8 @@ abstract public class DynamicExperimentThread extends Thread { } else { - while(!inState(StandardExperimentStates.Running.class) && inActiveState()) { - - synchronized(tasks) { + synchronized(tasks) { + while(!inState(StandardExperimentStates.Running.class) && inActiveState()) { int ran = runTasks(); if(ran == 0) { try {