Skip to content
Snippets Groups Projects
Commit 68837ea2 authored by Guillaume Valadon's avatar Guillaume Valadon Committed by GitHub
Browse files

Merge pull request #526 from gpotter2/fix-stuck

[Tests] Fix automaton stuck
parents 55f7c4d2 92d3cefa
No related branches found
No related tags found
No related merge requests found
...@@ -547,9 +547,11 @@ class Automaton: ...@@ -547,9 +547,11 @@ class Automaton:
self.debug(2, "%s [%s] not taken" % (cond.atmt_type, cond.atmt_condname)) self.debug(2, "%s [%s] not taken" % (cond.atmt_type, cond.atmt_condname))
def _do_start(self, *args, **kargs): def _do_start(self, *args, **kargs):
threading.Thread(target=self._do_control, args=(args), kwargs=kargs).start() ready = threading.Event()
threading.Thread(target=self._do_control, args=(ready,) + (args), kwargs=kargs).start()
ready.wait()
def _do_control(self, *args, **kargs): def _do_control(self, ready, *args, **kargs):
with self.started: with self.started:
self.threadid = threading.currentThread().ident self.threadid = threading.currentThread().ident
...@@ -568,6 +570,8 @@ class Automaton: ...@@ -568,6 +570,8 @@ class Automaton:
singlestep = True singlestep = True
iterator = self._do_iter() iterator = self._do_iter()
self.debug(3, "Starting control thread [tid=%i]" % self.threadid) self.debug(3, "Starting control thread [tid=%i]" % self.threadid)
# Sync threads
ready.set()
try: try:
while True: while True:
c = self.cmdin.recv() c = self.cmdin.recv()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment