]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed race condition in DynamicExperimentThread. 48/2248/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Wed, 26 Sep 2018 10:58:58 +0000 (13:58 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 26 Sep 2018 12:22:06 +0000 (12:22 +0000)
gitlab #136

Change-Id: I533e274bef62e7ce939c9a67a37d8e86d6f38bce
(cherry picked from commit 1b6efbcb17b7cf648145f83b1a82f6e1c1dce22e)

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

index 66cec38a46b62664c0a5037af4d24060378730b2..836c7920f4487e70490a581cc6a0d8bc1a434fea 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 {