⚙️Deadlock
Also known as Deadlocks, Deadly Embrace
Two tasks each wait for the other. So neither can ever go on.
Think of it like
Think of it like two cars meeting on a narrow bridge. Neither will back up, so neither can move.
Example
Emma's bank app moves money between two accounts. One thread locks Lucy then Jack, the other locks Jack then Lucy. Both wait forever.
Why it matters
A deadlock gives no error message. The app just stops, which makes it one of the hardest bugs to spot.
Definition
Common mistake
Key takeaways
- 1Wait in a circle. Each holds what the other needs.
- 2Silent freeze. No error shown.
- 3Same order. Take locks the same way.