【问题标题】:Sync (oswego) vs Lock (JDK5)同步(oswego)与锁定(JDK5)
【发布时间】:2009-03-31 02:49:50
【问题描述】:

只是为了确定,专家能否证实

java.util.concurrent.locks.Lock

还有Doug Lea的原版Sync

基本上是一样的东西,只是名字不同。

  • 获取与锁定
  • 释放与解锁

【问题讨论】:

    标签: java multithreading concurrency


    【解决方案1】:

    实现 Lock 的 ReentrantLock 包装了一个名为 Sync 的类。都是由Doug Lea写的。我建议你尝试使用 Java 中的库。

    【讨论】:

      【解决方案2】:

      不管怎样,java.util.concurrent.locks.Lock 的源代码将 Doug Lea 列为其作者。该包中的许多其他文件也是如此。

         /*
          * This file is available under and governed by the GNU General Public
          * License version 2 only, as published by the Free Software Foundation.
          * However, the following notice accompanied the original version of this
          * file:
          *
          * Written by Doug Lea with assistance from members of JCP JSR-166
          * Expert Group and released to the public domain, as explained at
          * http://creativecommons.org/licenses/publicdomain
          */
      

      【讨论】:

      • 是的,我知道。但是从概念的角度来看,它们可以被认为是等价的吗?
      猜你喜欢
      • 1970-01-01
      • 2011-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多