Hacker News new | ask | show | jobs
by rowls66 1100 days ago
Interesting. I wrote almost the same code for work a couple of weeks ago.

Not sore, but it looks like the Transition function has a race condition. It calls CanTansition() before acquiring the mutex lock. I think this could lead to illegal state transitions.

2 comments

Thanks for this. You are indeed correct. I've pushed a fix and also added a race test to confirm the fix.
Good eye! Thanks for pointing this out.