Latest Tweets:

"If two threads have opposite ideas of what a and b are, this carries the potential for deadlock. Some way needs to be found to ensure that every thread locks the same object first. In the absence of any other way to do it, an ordering can be imposed on these objects by comparing their addresses. If we always lock the one with the lower address first, we’ll never deadlock, even with multiple threads grabbing the objects from different sources and not communicating with each other."

mikeash.com: Deadlocks and Lock Ordering: a Vignette. Wow! I can’t believe I’ve never seen this before, it’s so simple and elegant.