Tuesday, May 6, 2008

Deadlock with a single thread in Java

The classical definition of a deadlock involves two threads at the least. The other day I was joking with my colleague that it takes talent to deadlock with a single thread. It got me thinking if it is even possible. Then I realized the following code will deadlock with just a single thread.


Like I said, it takes talent ;)