简单的Lock死锁例子

    static void Main(string[] args)
        {
            lock (_lock1)
            {
                var t = new Thread(() => {
                    lock (_lock1)
                    {
                        Console.WriteLine("Lock1: ");
                    }
                });
                t.Start();
                t.Join();
            }
           
            Console.ReadKey();
        }
  static readonly object _lock1 = new object();

 

posted @ 2019-09-17 12:01  正定聚  阅读(251)  评论(0编辑  收藏  举报