Sample deadlock simulation in Threading

object lock1 = new object();
object lock2 = new object();

new Thread(() =>
{
lock (lock1)
{
Thread.Sleep(1000);
lock (lock2) ; // Deadlock
}
}).Start();
lock (lock2)
{
Thread.Sleep(1000);
lock (lock1) ; // Deadlock
}