diff options
author | michelou <michelou@epfl.ch> | 2006-02-22 17:54:31 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2006-02-22 17:54:31 +0000 |
commit | 96ae92e4f6f830a9a4e55768c3de0328a2a030ba (patch) | |
tree | 0b84d247c1693bf186787aaa8f0c75d89fea9be3 /docs/examples/computeserver.scala | |
parent | c1e184a3657d970a8fba6e3c7049f20a2e466bf0 (diff) | |
download | scala-96ae92e4f6f830a9a4e55768c3de0328a2a030ba.tar.gz scala-96ae92e4f6f830a9a4e55768c3de0328a2a030ba.tar.bz2 scala-96ae92e4f6f830a9a4e55768c3de0328a2a030ba.zip |
adapted code to Scala 2 syntax in files src/exa...
adapted code to Scala 2 syntax in files src/examples/**/*.scala
Diffstat (limited to 'docs/examples/computeserver.scala')
-rw-r--r-- | docs/examples/computeserver.scala | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/docs/examples/computeserver.scala b/docs/examples/computeserver.scala index acc4a0b93e..7e63455258 100644 --- a/docs/examples/computeserver.scala +++ b/docs/examples/computeserver.scala @@ -5,28 +5,28 @@ import concurrent._, concurrent.ops._; class ComputeServer(n: Int) { private trait Job { - type t; - def task: t; - def ret(x: t): Unit; + type t + def task: t + def ret(x: t): Unit } - private val openJobs = new Channel[Job](); + private val openJobs = new Channel[Job]() private def processor(i: Int): Unit = { while (true) { - val job = openJobs.read; - Console.println("read a job"); + val job = openJobs.read + Console.println("read a job") job.ret(job.task) } } def future[a](p: => a): () => a = { - val reply = new SyncVar[a](); + val reply = new SyncVar[a]() openJobs.write{ new Job { - type t = a; - def task = p; - def ret(x: a) = reply.set(x); + type t = a + def task = p + def ret(x: a) = reply.set(x) } } () => reply.get @@ -35,8 +35,8 @@ class ComputeServer(n: Int) { spawn(replicate(0, n) { processor }) } -object computeserver with Application { - val server = new ComputeServer(1); - val f = server.future(42); +object computeserver extends Application { + val server = new ComputeServer(1) + val f = server.future(42) Console.println(f()) } |