diff options
author | Philipp Haller <hallerp@gmail.com> | 2007-02-05 17:22:57 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2007-02-05 17:22:57 +0000 |
commit | b277d15d25f322818921e3006e80e3f34aa8014a (patch) | |
tree | 08c345f702c22714694ebdd6d1cc477773df4f10 /src | |
parent | 2f4f3d3db7c2eb9ed535065ffed8098a99de0278 (diff) | |
download | scala-b277d15d25f322818921e3006e80e3f34aa8014a.tar.gz scala-b277d15d25f322818921e3006e80e3f34aa8014a.tar.bz2 scala-b277d15d25f322818921e3006e80e3f34aa8014a.zip |
scala.actors: removed ugly flow control.
Diffstat (limited to 'src')
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index fb2978ec9f..2e0d0185d5 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -472,8 +472,6 @@ trait Actor extends OutputChannel[Any] { private[actors] var kill = () => {} - private class ExitSuspendLoop extends Throwable - def suspendActor() { isWaiting = true while(isWaiting) { @@ -492,24 +490,21 @@ trait Actor extends OutputChannel[Any] { var waittime = msec var fromExc = false isWaiting = true - - try { - while(isWaiting) { - try { - fromExc = false - wait(waittime) - } catch { - case _: InterruptedException => { - fromExc = true - val now = Platform.currentTime - val waited = now-ts - waittime = msec-waited - if (waittime < 0) { isWaiting = false } - } + while(isWaiting) { + try { + fromExc = false + wait(waittime) + } catch { + case _: InterruptedException => { + fromExc = true + val now = Platform.currentTime + val waited = now-ts + waittime = msec-waited + if (waittime < 0) { isWaiting = false } } - if (!fromExc) throw new ExitSuspendLoop } - } catch { case _: ExitSuspendLoop => } + if (!fromExc) { isWaiting = false } + } // links: check if we should exit if (shouldExit) exit() } |