Viscent / javamtp

《Java多线程编程实战指南(设计模式篇)》源码

Home Page:http://viscent.iteye.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ch4.gs 死锁问题

linzhongxia opened this issue · comments

NestedMonitorLockoutExample类中内部类Helper
方法xGuarededMethod 和 方法xStateChanged 是否应该去掉 synchronized
blocker。callWithGuard(ga)内中lock锁,即使lock.wait.但是NestedMonitorLockoutExample对象锁未释放

楼上说的对 作者这个地方的synchronized是个bug

不是问题。这个类,正如其类所示就是为了展示“嵌套监视器锁死”(类似死锁)而写的。参见:
Viscent/JavaConcurrencyPattern#2