summaryrefslogtreecommitdiff
path: root/test/files/run/lazy-concurrent.scala
blob: 4699ed6a151a35982d1a311529a588e18470c1d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
object Test {
  def main(args: Array[String]) {
    class Singleton {
      val field = ()
      println("Initializing singleton.")
    }
    lazy val Singleton = new Singleton

    var i = 0
    while (i < 4) {
      new Thread(new Runnable {
        def run = Singleton.field
      }).start
      i += 1
    }
  }
}