• When to select ReentrantLock over synchronized

    什么时候选择ReentrantLock 代替synchronized

    youdao

  • Listing 1. Protecting a block of code with ReentrantLock.

    清单1.ReentrantLock保护代码

    youdao

  • Or even rewrite our existing synchronized code in terms of ReentrantLock?

    或者甚至ReentrantLock重写我们现有synchronized代码

    youdao

  • Instead, make the decision on the basis of whether you need the power of ReentrantLock.

    相反,应当根据是否需要ReentrantLock能力来作出选择。

    youdao

  • The stated goal was to answer the question, "Which is faster, synchronization or ReentrantLock?"

    此举的目的回答以下问题:“一个更快同步还是 ReentrantLock?”

    youdao

  • Before entering the critical section, the lock method of the ReentrantLock object is invoked to try and obtain the lock.

    进入关键部分之前,调用ReentrantLock对象lock方法尝试获得

    youdao

  • However, the existence of these obvious benefits are not a good enough reason to always prefer ReentrantLock to synchronized.

    但是这些明显存在好处不足以成为用ReentrantLock代替synchronized的理由

    youdao

  • It purports to measure the performance costs of synchronization and ReentrantLock, techniques used to coordinate the action of multiple threads.

    这个基准目的是要度量同步ReentrantLock性能代价,它们是用于协调多个线程行为的不同技术

    youdao

  • You'll see that atomic variables offer an additional improvement over ReentrantLock, which already had a big advantage over synchronization.

    看到,虽然ReentrantLock 拥有比同步更多的优点,但相对于 ReentrantLock原子变量提供其他改进

    youdao

  • While that column showed how the new ReentrantLock class is a more scalable replacement for synchronization, for some problems there is an even better approach.

    虽然专栏说明新的ReentrantLock如何可以可伸缩地替代同步,但是对于一些问题还有更好解决方法

    youdao

  • Because so little work is done in each unit of work, the graphs below probably understate the scalability benefits of atomic variables compared to ReentrantLock.

    因为每个工作单元完成工作很少,所以下图可能无法完全地说明与ReentrantLock相比原子变量具有哪些可伸缩性优点

    youdao

  • Similarly, attempting to acquire an intrinsic lock (enter a synchronized block) cannot be interrupted, but ReentrantLock supports an interruptible acquisition mode.

    类似地尝试获取内部的操作(进入synchronized)不能被中断的,但是ReentrantLock支持中断获取模式。

    youdao

  • This means that when many threads are all contending for the same lock, the total throughput is generally going to be better with ReentrantLock than with synchronized.

    意味着许多线程同一个锁时使用ReentrantLock总体开支通常synchronized少得多。

    youdao

  • The ReentrantLock class, which implements Lock, has the same concurrency and memory semantics as synchronized, but also adds features like lock polling, timed lock waits, and interruptible lock waits.

    ReentrantLock实现了Lock拥有与 synchronized相同并发性内存语义但是添加了类似投票定时等候和可中断锁等候的一些特性

    youdao

  • The ReentrantLock class, which implements Lock, has the same concurrency and memory semantics as synchronized, but also adds features like lock polling, timed lock waits, and interruptible lock waits.

    ReentrantLock实现了Lock拥有与 synchronized相同并发性内存语义但是添加了类似投票定时等候和可中断锁等候的一些特性

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定