diff options
Diffstat (limited to 'src/actors')
-rw-r--r-- | src/actors/scala/actors/Future.scala | 13 | ||||
-rw-r--r-- | src/actors/scala/actors/TickedScheduler.scala | 24 | ||||
-rw-r--r-- | src/actors/scala/actors/TimerThread.scala | 7 |
3 files changed, 31 insertions, 13 deletions
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index f7f4220a15..377e2f826f 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -1,3 +1,12 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id: $ package scala.actors @@ -58,7 +67,7 @@ object Futures { var cnt = 0 val mappedFts = fts.map(ft => - Pair({cnt=cnt+1; cnt-1}, ft)) + Pair({cnt+=1; cnt-1}, ft)) val unsetFts = mappedFts.filter((p: Pair[int, Future[Any]]) => { if (p._2.isSet) { resultsMap(p._1) = Some(p._2()); false } @@ -101,7 +110,7 @@ object Futures { var results: List[Option[Any]] = Nil val size = resultsMap.size - for (val i <- 0 until size) { + for (i <- 0 until size) { results = resultsMap(size - i - 1) :: results } results diff --git a/src/actors/scala/actors/TickedScheduler.scala b/src/actors/scala/actors/TickedScheduler.scala index c4da9bd298..ffb451c971 100644 --- a/src/actors/scala/actors/TickedScheduler.scala +++ b/src/actors/scala/actors/TickedScheduler.scala @@ -1,12 +1,20 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ -package scala.actors +// $Id: $ -import compat.Platform +package scala.actors -import java.lang.{Runnable, Thread, InterruptedException} +import java.lang.{Thread, InterruptedException} import scala.collection.Set -import scala.collection.mutable.{ArrayBuffer, Buffer, HashMap, Queue, Stack, HashSet} +import scala.collection.mutable.{ArrayBuffer, Buffer, HashMap, Queue} +import scala.compat.Platform /** * <p>This scheduler uses a thread pool to execute tasks that are generated @@ -30,16 +38,16 @@ class TickedScheduler extends Thread with IScheduler { private var pendingReactions = 0 def pendReaction: unit = synchronized { - pendingReactions = pendingReactions + 1 + pendingReactions += 1 } def unPendReaction: unit = synchronized { - pendingReactions = pendingReactions - 1 + pendingReactions -= 1 } def printActorDump {} def start(task: Reaction): unit = synchronized { - pendingReactions = pendingReactions + 1 + pendingReactions += 1 execute(task) } @@ -48,7 +56,7 @@ class TickedScheduler extends Thread with IScheduler { private var TICK_FREQ = 5 private var CHECK_FREQ = 50 - for (val i <- List.range(0, 2)) { + for (i <- List.range(0, 2)) { val worker = new WorkerThread(this) workers += worker worker.start() diff --git a/src/actors/scala/actors/TimerThread.scala b/src/actors/scala/actors/TimerThread.scala index 7f355761fc..f6a45d98ff 100644 --- a/src/actors/scala/actors/TimerThread.scala +++ b/src/actors/scala/actors/TimerThread.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -11,9 +11,10 @@ package scala.actors -import compat.Platform import java.lang.{InterruptedException, Runnable, Thread} + import scala.collection.mutable.PriorityQueue +import scala.compat.Platform /** * This class allows the (local) sending of a message to an actor after @@ -50,7 +51,7 @@ object TimerThread { } // process guys waiting for signal and empty list - for (val wa <- lateList) { + for (wa <- lateList) { if (wa.valid) { wa.actor ! TIMEOUT } |