From: Reino Ruusu Date: Wed, 26 Sep 2018 10:58:58 +0000 (+0300) Subject: Fixed race condition in DynamicExperimentThread. X-Git-Tag: v1.43.0~136^2~354 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=1b6efbcb17b7cf648145f83b1a82f6e1c1dce22e;p=simantics%2Fplatform.git Fixed race condition in DynamicExperimentThread. gitlab #136 Change-Id: I533e274bef62e7ce939c9a67a37d8e86d6f38bce --- 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 e3e4f9ba5..0967bfdbc 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 {