Rust - Multithreading - ABBA deadlock with Arc, Mutex and OS Thread
Your program compiles, runs, prints nothing, and simply sits there forever. Welcome to the deadlock club, the most silent bug family in concurrent programming. In this tutorial we build the most classic deadlock of all, the lock ordering deadlock, also known as the ABBA deadlock. Our playground: two embedded bus devices, SPI and I2C, each protected by its own Mutex. Two threads transfer data between the buses in opposite directions, each locking its source first. ...