summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-07-10 12:01:33 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-07-10 12:01:33 +0000
commitf12e0645fff0039e5cb681cb766a1b2be884e61d (patch)
treebdd461e21ec6b2501e3ca3cf349bf47f43dc7535 /test/files/run
parent913cd101937243304d9879556e951895960c5f53 (diff)
downloadscala-f12e0645fff0039e5cb681cb766a1b2be884e61d.tar.gz
scala-f12e0645fff0039e5cb681cb766a1b2be884e61d.tar.bz2
scala-f12e0645fff0039e5cb681cb766a1b2be884e61d.zip
Move the sync-var test into the correct directory.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/sync-var.check1
-rw-r--r--test/files/run/sync-var.scala53
2 files changed, 0 insertions, 54 deletions
diff --git a/test/files/run/sync-var.check b/test/files/run/sync-var.check
deleted file mode 100644
index e77aa319a5..0000000000
--- a/test/files/run/sync-var.check
+++ /dev/null
@@ -1 +0,0 @@
-50005000 50005000 true
diff --git a/test/files/run/sync-var.scala b/test/files/run/sync-var.scala
deleted file mode 100644
index aa6ae9fa34..0000000000
--- a/test/files/run/sync-var.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-import java.util.concurrent._
-import java.util.concurrent.atomic._
-
-object Test { def main(args: Array[String]) {
-
-val n = 10000
-val i = new AtomicInteger(n)
-val j = new AtomicInteger(n)
-val sum = new AtomicInteger
-
-val q = new scala.concurrent.SyncVar[Int]
-
-val producers = (1 to 3).force map { z => new Thread {
- override def run() {
- var again = true
- while (again) {
- val x = i.getAndDecrement()
- if (x > 0)
- q put x
- else
- again = false
- }
- }
-} }
-
-val summers = (1 to 7).force map { z => new Thread {
- override def run() {
- val x = j.decrementAndGet()
- if (x >= 0) {
- sum addAndGet q.take()
- }
- if (x > 0) {
- run()
- } else {
- // done
- }
- }
-} }
-
-summers foreach { _.start() }
-producers foreach { _.start() }
-
-summers foreach { _.join() }
-
-val got = sum.get
-val expected = (n + 1) * n / 2
-println(got + " " + expected + " " + (got == expected))
-
-producers foreach { _.join() }
-
-} }
-
-// vim: set ts=2 sw=2 et: