IntricCondition 和 expliciteCondition 的区别 与 intrinsicLoc和expliciteLock的区别很相似, expliciteCondition提供了更多的功能,比如,fair和unfair的wait,notify
不同conditionPredictes 使用不用的condition,不同的waitSet, 一个expliciteLock可以有多个conditon.
不同的conditionPredicates使用不同的codition,一方面代码比较好读,另一方面,减少了无效的notifyAll(),减少了不必要的线程切换.
There is an important three‐way relationship in a condition wait involving locking, the wait method, and a condition
predicate. The condition predicate involves state variables, and the state variables are guarded by a lock, so before
testing the condition predicate, we must hold that lock.
Just as with built‐in locks and condition queues, the three‐way relationship among the lock, the condition predicate, and
the condition variable must also hold when using explicit Lock s and Condition s. The variables involved in the condition
predicate must be guarded by the Lock , and the Lock must be held when testing the condition predicate and when
calling await and signal . [11]