Fixed race condition in DynamicExperimentThread. 47/2247/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Wed, 26 Sep 2018 10:58:58 +0000 (13:58 +0300)
committerReino Ruusu <reino.ruusu@semantum.fi>
Wed, 26 Sep 2018 11:01:33 +0000 (14:01 +0300)
gitlab #136

Change-Id: I533e274bef62e7ce939c9a67a37d8e86d6f38bce

bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java

index e3e4f9ba56dad94b8f9de99ac7a868327a67e5e6..0967bfdbc28d19c3e5b69eae0980128fa296ad92 100644 (file)
@@ -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 {