Skip to content
State machine (FSM) templates

Teaching Case — A Deadlock Drawn as an Ordinary Box

`Held` is not marked final and has no transition out, so a run that arrives there stops and the machine has not finished. That is a deadlock, and it is drawn as a rounded box exactly like the states around it — the same shape, the same stroke, in the same row as the state that does finish. Note what the engine does NOT say: a final state IS reachable, by the other branch, so the machine can terminate and this is one stuck path rather than a machine that never ends.

Template previewState machine (FSM)
Payment capture3 states · 2 transitions · 1 eventscapture [funds available]capture [review required]AuthorisedCapturedHeld1 thing is probably not what was meant; every transition names states that exist.WARN`Held` is not final, and no run that arrives there can reach the final state: `Held` has no transition out at all — adeadlock. Drawn as a box like every other box.OKAll 3 states are reachable from `Authorised`.OKAll 2 transitions name states that exist, so every arrow in the figure is drawn.

What this template contains

Source
7 lines

Make it your own.

title "Payment capture"

state Authorised
state Captured  final
state Held

initial Authorised

transition Authorised -> Captured on "capture" [funds available]
transition Authorised -> Held     on "capture" [review required]