Skip to content

Commit f4e5562

Browse files
author
Josh Wilson
committed
adding getCurrentStateOrTransition()
1 parent 1f4bc1c commit f4e5562

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

direct/src/fsm/FSM.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,18 @@ def getCurrentOrNextState(self):
204204
finally:
205205
self.fsmLock.release()
206206

207+
def getCurrentStateOrTransition(self):
208+
# Returns the current state if we are in a state now, or the
209+
# transition we are performing if we are currently within
210+
# the enter or exit function for a state.
211+
self.fsmLock.acquire()
212+
try:
213+
if self.state:
214+
return self.state
215+
return '%s -> %s' % (self.oldState, self.newState)
216+
finally:
217+
self.fsmLock.release()
218+
207219
def isInTransition(self):
208220
self.fsmLock.acquire()
209221
try:

0 commit comments

Comments
 (0)