Skip to content
Snippets Groups Projects
Commit 974dbc4b authored by Phil's avatar Phil
Browse files

Simplify automaton control loop

parent 36f92713
No related branches found
No related tags found
No related merge requests found
...@@ -395,9 +395,8 @@ class Automaton: ...@@ -395,9 +395,8 @@ class Automaton:
def do_control(self): def do_control(self):
singlestep = True singlestep = True
self.debug(3, "Starting control thread [tid=%i]" % self.threadid) self.debug(3, "Starting control thread [tid=%i]" % self.threadid)
stop = False
try: try:
while not stop: while True:
c = self.cmdin.recv() c = self.cmdin.recv()
self.debug(5, "Received command %s" % c.type) self.debug(5, "Received command %s" % c.type)
if c.type == _ATMT_Command.RUN: if c.type == _ATMT_Command.RUN:
...@@ -409,21 +408,15 @@ class Automaton: ...@@ -409,21 +408,15 @@ class Automaton:
while True: while True:
try: try:
state = self.do_next() state = self.do_next()
except KeyboardInterrupt:
self.debug(1,"Interrupted by user")
stop=True
break
except self.CommandMessage: except self.CommandMessage:
break break
except StopIteration,e:
c = Message(type=_ATMT_Command.END, result=e.args[0])
self.cmdout.send(c)
stop=True
break
if singlestep: if singlestep:
c = Message(type=_ATMT_Command.SINGLESTEP,state=state) c = Message(type=_ATMT_Command.SINGLESTEP,state=state)
self.cmdout.send(c) self.cmdout.send(c)
break break
except StopIteration,e:
c = Message(type=_ATMT_Command.END, result=e.args[0])
self.cmdout.send(c)
except Exception,e: except Exception,e:
self.debug(3, "Transfering exception [%s] from tid=%i"% (e,self.threadid)) self.debug(3, "Transfering exception [%s] from tid=%i"% (e,self.threadid))
m = Message(type = _ATMT_Command.EXCEPTION, exception=e) m = Message(type = _ATMT_Command.EXCEPTION, exception=e)
......
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