2017年6月20日

摘要: 转自: https://my.oschina.net/readjava/blog/282882 摘要: 要学习JAVA中是如何实现线程间的锁,就得从LockSupport这个类先说起,因为这个类实现了底层的一些方法,各种的锁实现都是这个基础上发展而 来的。这个类方法很少,但理解起来需要花费一点时间, 阅读全文
posted @ 2017-06-20 12:03 冰花ぃ雪魄 阅读(1470) 评论(0) 推荐(0)
 
摘要: 1. Thread.yield(): api中解释: 暂停当前正在执行的线程对象,并执行其他线程。 注意:这里的其他也包含当前线程,所以会出现以下结果。 输出结果: 1122 或者 1212 2. Thread.sleep(long millis): 解释:使当前线程暂停millis所指定的毫秒,转 阅读全文
posted @ 2017-06-20 11:47 冰花ぃ雪魄 阅读(327) 评论(0) 推荐(0)
 
摘要: /** * Disables the current thread for thread scheduling purposes unless the * permit is available. * * <p>If the permit is available then it is consum 阅读全文
posted @ 2017-06-20 11:46 冰花ぃ雪魄 阅读(1622) 评论(0) 推荐(0)