Java multithreading -- ReentrantLock -- use / example / principle
Original website: Java multithreading -- ReentrantLock -- use / example / principle_ CSDN blog
brief introduction
explain
This article introduces ReentrantLock (reentrant exclusive lock) in Java's JUC. Including: usage and principle.
summary
ReentrantLock is mainly implemented ...
Posted by mailtome on Mon, 08 Nov 2021 14:26:51 -0800
Implementation principle of ReentrantLock
Introduction to ReentrantLock
ReentrantLock implements the Lock interface and is a reentrant exclusive lock.
ReentrantLock is more flexible and powerful than synchronized synchronous locks, such as implementing a fair lock mechanism.
First, let's look at what a fair lock mechanism is.
Fair Lock Mechanism for ReentrantLock
As we know, Reent ...
Posted by moboter on Thu, 30 Sep 2021 09:41:20 -0700