ReentrantLock类

ReentrantLock 与synchronized相比有以下特点 可中断 可以设置为公平锁 支持多个条件变量 与sychronized一样的 支持可重入锁 可打断锁(避免死锁):使用lockInterruptibly()方法 public class TestReentrant { privat
posted @ 2024-06-09 20:50  csm~/  阅读(1)  评论(0编辑  收藏  举报