Thread tr0 = new Thread(new ParameterizedThreadStart((obj1) =>
            {
                lock (aaa)
                {
                    Thread.Sleep(3000);
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        Thread.Sleep(3000);
                    }));
                }
            }));
            tr0.IsBackground = true;
            tr0.Start();

            Thread.Sleep(3000);
            lock (aaa)
            {
                Thread.Sleep(3000);
            }

 

在线程里面访问主线程,主线程和线程共用一把锁互相等待导致死锁。

相关文章:

  • 2021-11-11
  • 2021-05-01
  • 2021-11-27
  • 2022-12-23
  • 2021-10-02
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2021-06-18
  • 2021-05-18
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案