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]

IntricCondition和expliciteCondition比较的更多相关文章

随机推荐

  1. inline修饰虚函数的问题

    虚函数是否可以内联? 一般来说,inline是编译时的行为,虚函数是在程序执行时的行为,因此编译器一般会拒绝对虚函数进行内联!

  2. How to Configure Eclipse for Python --- 在eclipse中如何配置pydev

    From: http://www.rose-hulman.edu/class/csse/resources/Eclipse/eclipse-python-configuration.htm Pytho ...

  3. Ant+jmeter 实现自动化性能测试

    一.前言 性能测试首选的工具是JMeter,在此不多做介绍,但是不得不说JMeter也是一款非常好的接口测试工具.性能测试过程中手工重复的活动非常多,为了给客户提供一个性能测试报告,我用了一周时间进行 ...

  4. UI“三重天”之selenium--常用API和问题处理(三)

    Selenium常用API: 前面两篇示例代码中用到了一些selenium的API方法,例如定位元素的八种方法.访问url.等待.操作浏览器.获取title.点击.清理等等. 有关于selenium的 ...

  5. CSS布局模型学习

    转自:http://www.cnblogs.com/erliang/p/4092192.html CSS布局模型学习   参考链接慕课网:HTML+CSS基础课程 知识基础 1. 样式 内联 嵌入 外 ...

  6. selenium webdriver——JS滚动到最底部

    JS控制滚动条的位置: window.scrollTo(x,y); 竖向滚动条置顶 window.scrollTo(0,0); 竖向滚动条置底 window.scrollTo(0,document.b ...

  7. leetcode172

    public class Solution { public int TrailingZeroes(int n) { ) { ; } else { ; var y = TrailingZeroes(x ...

  8. delphi TEncoding

    #include <tchar.h> #include <memory> //For STL auto_ptr class //------------------------ ...

  9. Windows10 IME占用过高临时解决办法

    解决方案: 在管理员模式下运行命令提示符,并输入如下命令 if exist "%SystemRoot%\System32\InputMethod\CHS\ChsIME.exe" ( ...

  10. 归纳整理Linux下C语言常用的库函数----时间日期数学及算法

    在没有IDE的时候,记住一些常用的库函数的函数名.参数.基本用法及注意事项是很有必要的. 参照Linux_C_HS.chm的目录,我大致将常用的函数分为一下几类: 1. 内存及字符串控制及操作 2. ...