1、暂停线程

  暂停线程意味着此线程还可以恢复运行。再Java多线程中,可以使 suspend() 方法暂停线程,使用 resume() 方法恢复线程的执行

 

2、suspend() 与 resume() 方法的缺点——独占

  在使用 suspend() 与 resume() 方法时,如果使用不恰当,极易造成公共的同步对象的独占,使得其他线程无法访问公共同步对象。

 

3、suspend() 与 resume() 方法的缺点——不同步

  在使用 suspend() 与 resume() 方法时也容易出现因为线程的暂停而导致数据不同步的情况。

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2021-12-12
  • 2021-12-15
  • 2022-12-23
  • 2021-05-27
  • 2021-12-12
  • 2022-12-23
猜你喜欢
  • 2021-12-12
  • 2021-12-12
  • 2021-12-22
  • 2022-12-23
  • 2021-12-22
  • 2022-02-22
  • 2021-12-12
相关资源
相似解决方案