前言

ReentrantLock是非常常用的锁,在前面【从入门到放弃-Java】并发编程-JUC- edBlockingQueue在我们了解到, edBlockingQueue入队、出队都是依赖ReentrantLock进行锁同步和线程唤醒、等待的。
本文来学习下ReentrantLock。

ReentrantLock

/** * Creates an instance of {@code ReentrantLock}. * This is equivalent to using {@code ReentrantLock(false)}. */public ReentrantLock() {    sync = new NonfairSync();}/** * Creates an instance of {
收藏 打印