]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed another source of deadlocks in DynamicExperimentThread. 10/2310/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Fri, 12 Oct 2018 11:39:29 +0000 (14:39 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 15 Oct 2018 09:24:57 +0000 (09:24 +0000)
gitlab #136

Change-Id: Iabeef360c93d617a38cbc7883533c3cb487ae6f2
(cherry picked from commit 685ae86876e6c246694bc6a94eac717ccb1e28cc)

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

index 0967bfdbc28d19c3e5b69eae0980128fa296ad92..9ee57f51055aec994a49d33f08726fec5a21c9ca 100644 (file)
@@ -138,10 +138,12 @@ abstract public class DynamicExperimentThread extends Thread {
 
                                                if(deltaNs > 0) {
                                                        synchronized(tasks) {
-                                                               try {
-                                                                       tasks.wait(deltaMs, deltaNsRem);
-                                                               } catch (InterruptedException e) {
-                                                                       e.printStackTrace();
+                                                               if (inState(StandardExperimentStates.Running.class)) {
+                                                                       try {
+                                                                               tasks.wait(deltaMs, deltaNsRem);
+                                                                       } catch (InterruptedException e) {
+                                                                               LOGGER.warn("Dynamic experiment thread '" + this.getName() + "' (" + this.getClass().getName() + ") interrupted", e);
+                                                                       }
                                                                }
                                                        }
                                                }
@@ -158,7 +160,7 @@ abstract public class DynamicExperimentThread extends Thread {
                                                        try {
                                                                tasks.wait(Integer.MAX_VALUE);
                                                        } catch (InterruptedException e) {
-                                                               e.printStackTrace();
+                                                               LOGGER.warn("Dynamic experiment thread '" + this.getName() + "' (" + this.getClass().getName() + ") interrupted", e);
                                                        }
                                                }
                                        }