美文网首页
ReentrantLock

ReentrantLock

作者: chrisghb | 来源:发表于2022-08-12 16:43 被阅读0次
// 一种可重入的独占锁
ReentrantLock lock=new ReentrantLock();
Condition Condition = lock.newCondition();

lock.lock();

Condition.await();
// https://segmentfault.com/a/1190000015807209
Condition.signal();
try {
    
} catch (Exception e) {
    logger.error(e);
}finally{
    lock.unlock();
}

相关文章

网友评论

      本文标题:ReentrantLock

      本文链接:https://www.haomeiwen.com/subject/hmnzbrtx.html