AQS

概述

AbstractQueuedSynchronized

image1
子类需要实现的方法 image2
获取/释放锁 image3
设计模式 模板方法

自定义锁

lockInterruptibly 打断是指,在reentrantlock等待获取锁时,可以有其他的线程调用interrupt()方法,打断他的等待,防止一直等待下去照成死锁
mylock的基本功能

image4

MySync--aqs的子类,

是锁基本功能的提供者

image6