All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.concurrent.Lock.scala Maven / Gradle / Ivy

There is a newer version: 2.13.15
Show newest version
/*
 * Scala (https://www.scala-lang.org)
 *
 * Copyright EPFL and Lightbend, Inc.
 *
 * Licensed under Apache License 2.0
 * (http://www.apache.org/licenses/LICENSE-2.0).
 *
 * See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 */

package scala.concurrent

/** This class ...
 *
 *  @author  Martin Odersky
 */
@deprecated("use java.util.concurrent.locks.Lock", "2.11.2")
class Lock {
  var available = true

  def acquire() = synchronized {
    while (!available) wait()
    available = false
  }

  def release() = synchronized {
    available = true
    notify()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy