Skip to content

Commit 3ca3ff3

Browse files
committed
extended hsm doc slightly
add passage about copy behaviour
1 parent 0c00687 commit 3ca3ff3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ machine.is_C(allow_substates=True)
10521052

10531053
#### Reuse of previously created HSMs
10541054

1055-
Besides semantic order, nested states are very handy if you want to specify state machines for specific tasks and plan to reuse them. Be aware that this will *embed* the passed machine's states. This means if your states had been altered *before*, this change will be persistent.
1055+
Besides semantic order, nested states are very handy if you want to specify state machines for specific tasks and plan to reuse them. Be aware that this will *embed* the passed machine's states. This means if your states had been altered *before*, this change will be persistent.
10561056

10571057
```python
10581058
count_states = ['1', '2', '3', 'done']
@@ -1100,6 +1100,8 @@ collector.state
11001100

11011101
If a reused state machine does not have a final state, you can of course add the transitions manually. If 'counter' had no 'done' state, we could just add `['done', 'counter_3', 'waiting']` to achieve the same behaviour.
11021102

1103+
Note that the `HierarchicalMachine` will not integrate the machine instance itself but the states and transitions by creating copies of them. This way you are able to continue using your previously created instance without interfering with the embedded version.
1104+
11031105
#### <a name="threading"></a> Threadsafe(-ish) State Machine
11041106

11051107
In cases where event dispatching is done in threads, one can use either `LockedMachine` or `LockedHierarchicalMachine` where **function access** (!sic) is secured with reentrant locks. This does not save you from corrupting your machine by tinkering with member variables of your model or state machine.

0 commit comments

Comments
 (0)