summaryrefslogtreecommitdiff
path: root/src/actors
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2007-02-05 17:22:57 +0000
committerPhilipp Haller <hallerp@gmail.com>2007-02-05 17:22:57 +0000
commitb277d15d25f322818921e3006e80e3f34aa8014a (patch)
tree08c345f702c22714694ebdd6d1cc477773df4f10 /src/actors
parent2f4f3d3db7c2eb9ed535065ffed8098a99de0278 (diff)
downloadscala-b277d15d25f322818921e3006e80e3f34aa8014a.tar.gz
scala-b277d15d25f322818921e3006e80e3f34aa8014a.tar.bz2
scala-b277d15d25f322818921e3006e80e3f34aa8014a.zip
scala.actors: removed ugly flow control.
Diffstat (limited to 'src/actors')
-rw-r--r--src/actors/scala/actors/Actor.scala31
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()
}