摘要: class demo{ private ReentrantLock lock =new ReentrantLock(); private Condition cb = lock.newCondition(); private Condition cc = lock.newCondition(); p 阅读全文
posted @ 2020-03-12 16:49 超级学渣渣 阅读(135) 评论(0) 推荐(0) 编辑
摘要: JAVA多线程的形式比较独特,用的还是少了... class Clerk{ private int product; private ReentrantLock lock = new ReentrantLock(); private Condition con = lock.newCondition 阅读全文
posted @ 2020-03-12 14:26 超级学渣渣 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 闭锁示例 class count implements Runnable{ private CountDownLatch cdl; count(CountDownLatch cdl){ this.cdl=cdl; } @Override public void run() { synchronize 阅读全文
posted @ 2020-03-12 10:58 超级学渣渣 阅读(128) 评论(0) 推荐(0) 编辑