浏览代码

Fix the second part of the problem: also catch changes after the initial wait.

Yentl Van Tendeloo 8 年之前
父节点
当前提交
40897e072f
共有 1 个文件被更改,包括 9 次插入9 次删除
  1. 9 9
      src/python_sccd/python_sccd_runtime/statecharts_core.py

+ 9 - 9
src/python_sccd/python_sccd_runtime/statecharts_core.py

@@ -666,17 +666,17 @@ class ThreadsControllerBase(ControllerBase):
                     print '\rrunning %ims behind schedule' % (now - earliest_event_time),
                     self.last_print_time = now
                     self.behind = True
-            earliest_event_time = self.getEarliestEventTime()
-            if earliest_event_time == INFINITY:
-                if self.keep_running:
-                    with self.input_condition:
+            with self.input_condition:
+                earliest_event_time = self.getEarliestEventTime()
+                if earliest_event_time == INFINITY:
+                    if self.keep_running:
                         self.input_condition.wait()
                         earliest_event_time = self.getEarliestEventTime()
-                else:
-                    self.stop_thread = True
-            if self.stop_thread:
-                break
-            self.simulated_time = earliest_event_time
+                    else:
+                        self.stop_thread = True
+                if self.stop_thread:
+                    break
+                self.simulated_time = earliest_event_time
 
 class StatechartSemantics:
     # Big Step Maximality