When you have locks within your applicative code... you will have deadlock. Period. The only question you may ask is "when?" Same thing with API allowing you to wait without indicating any kind of timeout (e.g. TPL). Too bad... and too easy to shoot yourself in the foot...
But how to protect your code from race conditions without using lock?!? Easy answer: let Michonne help you.
"No lock... no deadlock!" Michonne is a library that allows you to erradicate deadlocks within your applicative code by providing you composable behaviors for tasks/lambdas execution (i.e. dispatcher, sequencer, balking dispatcher, etc), in replacement of locks and raw TPL primitives that will lead you to deadlocks.
- Posts serie about the Sequencer pattern Posts written by the father of this lib (Cyrille DUPUYDAUBY) where he explains the origin and the caracteristics of the sequencer pattern.
- Basses latences, hauts debits... A french talk made at DEVOXX FR 2014, where Cyrille and I talked about reactive programming, and explained the sequencer pattern, the notion of conflation etc.