diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-05-20 08:33:09 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-05-20 08:33:09 +0000 |
commit | 3f1d10d1051cca941c305ea0701c3981eae28c27 (patch) | |
tree | 25f80e5e5cf2476dd879ca4e6c94e6b9a81f5b6b | |
parent | eb96cbb7bcb487b3b1c8aacad61c6594ff695b51 (diff) | |
download | scala-3f1d10d1051cca941c305ea0701c3981eae28c27.tar.gz scala-3f1d10d1051cca941c305ea0701c3981eae28c27.tar.bz2 scala-3f1d10d1051cca941c305ea0701c3981eae28c27.zip |
Fixed #2000.
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 8c98f45d41..db1c52ad44 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -432,8 +432,8 @@ trait Actor extends AbstractActor { */ def receive[R](f: PartialFunction[Any, R]): R = { assert(Actor.self == this, "receive from channel belonging to other actor") - if (shouldExit) exit() // links this.synchronized { + if (shouldExit) exit() // links val qel = mailbox.extractFirst((m: Any) => f.isDefinedAt(m)) if (null eq qel) { waitingFor = f.isDefinedAt @@ -459,8 +459,9 @@ trait Actor extends AbstractActor { */ def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = { assert(Actor.self == this, "receive from channel belonging to other actor") - if (shouldExit) exit() // links this.synchronized { + if (shouldExit) exit() // links + // first, remove spurious TIMEOUT message from mailbox if any val spurious = mailbox.extractFirst((m: Any) => m == TIMEOUT) @@ -510,8 +511,8 @@ trait Actor extends AbstractActor { */ def react(f: PartialFunction[Any, Unit]): Nothing = { assert(Actor.self == this, "react on channel belonging to other actor") - if (shouldExit) exit() // links this.synchronized { + if (shouldExit) exit() // links val qel = mailbox.extractFirst((m: Any) => f.isDefinedAt(m)) if (null eq qel) { waitingFor = f.isDefinedAt @@ -537,8 +538,8 @@ trait Actor extends AbstractActor { */ def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = { assert(Actor.self == this, "react on channel belonging to other actor") - if (shouldExit) exit() // links this.synchronized { + if (shouldExit) exit() // links // first, remove spurious TIMEOUT message from mailbox if any val spurious = mailbox.extractFirst((m: Any) => m == TIMEOUT) @@ -1007,6 +1008,9 @@ trait Actor extends AbstractActor { this.synchronized { shouldExit = true exitReason = reason + // resume this Actor in a way that + // causes it to exit + // (because shouldExit == true) if (isSuspended) resumeActor() else if (isDetached) |