summaryrefslogtreecommitdiff
path: root/sources/scala/concurrent/Lock.scala
blob: c92aab9b7c5c9310ecb7b275191e7dd1e9846733 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package scala.concurrent;

class Lock with Monitor {
  var available = true;
  def acquire = {
    if (!available) wait();
    available = false
  }
  def release = {
    available = true;
    notify()
  }
}