2 ms·
> Now add multithreading. Still easy? > Now add locking. Still easy? Don't do that then. Or rather, either manipulate the state machine from only a single th
by pjc50 2y ago
> Now add multithreading. Still easy?
> Now add locking. Still easy?
Don't do that then.
Or rather, either manipulate the state machine from only a single thread at a time; or explicitly turn the multithreading into more states. If you need to wait for something instead of having "do X" you transition into state "doing X". C#-style async does this in a state machine behind the scenes.