reentrantlock
网络释义:可重入锁;重进入锁
网络释义
1.可重入锁 3.1.1.1 核心- AbstractQueuedSynchronizer 3.1.1.2 重进入锁- ReentrantLock ...
例句释义:,可重入锁,重进入锁1.However, the existence of these obvious benefits are not a good enough reason to always prefer ReentrantLock to synchronized.但是,这些明显存在的好处,还不足以成为用ReentrantLock代替synchronized的理由。
2.You'll see that atomic variables offer an additional improvement over ReentrantLock, which already had a big advantage over synchronization.您将看到,虽然ReentrantLock拥有比同步更多的优点,但相对于ReentrantLock,原子变量提供了其他改进。
3.So the fact that ReentrantLocks are "unfair" by default is simply making exppcit something that was true all along for synchronization.所以,默认情况下ReentrantLock是“不公平”的,这一事实只是把同步中一直是事件的东西表面化而已。
4.As a bonus, the implementation of ReentrantLock is far more scalable under contention than the current implementation of synchronized.除此之外,与目前的synchronized实现相比,争用下的ReentrantLock实现更具可伸缩性。
5.Or even rewrite our existing synchronized code in terms of ReentrantLock?或者甚至用ReentrantLock重写我们现有的synchronized代码?
6.The stated goal was to answer the question, "Which is faster, synchronization or ReentrantLock? "此举的目的是回答以下问题:“哪一个更快,同步还是ReentrantLock?”
7.ReentrantLock, in turn, uses atomic variables to maintain the queue of threads waiting for the lock.然后,ReentrantLock使用原子变量来维护等待锁定的线程队列。
8.However, using the new ReentrantLock approach, you will see a blocked count of zero.但是,使用新的ReentrantLock方式,会看到一个为0的阻塞计数。
9.Listing 1. Protecting a block of code with ReentrantLock.清单1.用ReentrantLock保护代码块。