当前位置:网站首页>Reentrantlock learning - Basic Attributes
Reentrantlock learning - Basic Attributes
2022-07-26 19:37:00 【virtuousOne】
After simple imitation of fair lock , Yes ReentrantLock The source code of .
The first node Node To understand the properties of .
// enumeration : Sharing mode
static final Node SHARED = new Node();
// enumeration : Exclusive mode
static final Node EXCLUSIVE = null;
// Indicates that the current node is in Cancel the state
static final int CANCELLED = 1;
// Indicates that the current node needs to wake up The subsequent nodes
static final int SIGNAL = -1;
waitStatus It is mainly through the state to judge the node
// node Turntable , Optional value (0,SINGAL -1 ,CANCELLED 1
// 0: Default state
// >0 Cancel the state
// == -1 , At present node If it is head Node time , After releasing the lock , Need to wake up his successor nodes
volatile int waitStatus;
// because node Need to build into fifo queue , therefore prev Point to the predecessor node
volatile Node prev;
// because node Need to build into fifo queue , therefore next Point to the successor node
volatile Node next;
// Current thread
volatile Thread thread;
// Head node anytime , The threads corresponding to the head node are all currently locked threads
private transient volatile Node head;
// Blocking queue tail node ,
private transient volatile Node tail;
// According to resources
// Exclusive lock mode :0 Unlocked state >0 Indicates that it has been locked
private volatile int state;
// In exclusive mode : Represents the thread that currently holds the lock
private transient Thread exclusiveOwnerThread;
边栏推荐
- C#上位机开发—— 修改窗口图标和exe文件图标
- 手机app测试用例怎么写?手机app测试点有哪些?
- 2022搭建企业级数据治理体系
- Four methods of closing forms in C #
- SEO, client rendering ', server rendering, search engine understanding
- 机器学习笔记 - 构建推荐系统(6) 用于协同过滤的 6 种自动编码器
- C#中关闭窗体的四种方法
- C # get local time / system time
- 洋葱集团携手OceanBase实现分布式升级,全球数据首次实现跨云融合
- Leetcode-138-copy linked list with random pointer
猜你喜欢

What is a server cluster? What are the advantages of overseas server clusters?

Reentrantlock learning --- basic method

篇7:exited on DESKTOP-DFF5KIK with error code -1073741511.

千万不要随便把 Request 传递到异步线程里面 , 有坑 你拿捏不住,得用 startAsync 方法才行

How to write the test case of mobile app? What are the mobile app test points?

“蔚来杯“2022牛客暑期多校训练营1

conda+pytorch环境教程

C # upper computer development - modify the window icon and exe file Icon

Usage scenarios for automated testing

Reentrantlock learning - lock release process
随机推荐
Usage scenarios for automated testing
MySQL教程:MySQL数据库学习宝典(从入门到精通)
【YOLOv5】--详细版训练自己的数据集 保姆级学习日志记录 手把手教程
The difference between advanced anti DDoS server and advanced anti DDoS IP
C # get local time / system time
Image preview embedding location of blog maintenance record
Selenium+Web自动化框架的Case
配置服务器环境
If the key is forgotten and multiple devices have different keys, how does the cloud synchronize
Introduce the difference between @getmapping and @postmapping in detail
手机app测试用例怎么写?手机app测试点有哪些?
[C language implementation] - dynamic / file / static address book
Redis6
Is it safe for CSC qiniu members to open preferential accounts? I don't know if it's the lowest Commission
“蔚来杯“2022牛客暑期多校训练营1
ReentrantLock学习之公平锁过程
通过源码深度分析线程池中Worker线程的执行流程
What is a server cluster? What are the advantages of overseas server clusters?
Detailed explanation of MySQL master-slave replication configuration
Mongodb stats counts the space occupied by the collection