diff options
author | Philipp Haller <hallerp@gmail.com> | 2011-07-07 17:32:31 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2011-07-07 17:32:31 +0000 |
commit | 9f4e1b050f5d83521e895a9f7b69a2169ec64a8a (patch) | |
tree | d03e6e4733c18e76cff43bdacea811eea1d45db7 /src | |
parent | 2ef447e26660842e2e941221f07f851e57098bb9 (diff) | |
download | scala-9f4e1b050f5d83521e895a9f7b69a2169ec64a8a.tar.gz scala-9f4e1b050f5d83521e895a9f7b69a2169ec64a8a.tar.bz2 scala-9f4e1b050f5d83521e895a9f7b69a2169ec64a8a.zip |
Fixes SI-4759
Diffstat (limited to 'src')
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 25cfbf7865..57e107538c 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -590,20 +590,27 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu receiveTimeout } else { if (onTimeout.isEmpty) { - waitingFor = f - received = None - isSuspended = true + if (!f.isDefinedAt(TIMEOUT)) + sys.error("unhandled timeout") + val thisActor = this onTimeout = Some(new TimerTask { - def run() { thisActor.send(TIMEOUT, thisActor) } + def run() { + thisActor.send(TIMEOUT, thisActor) + } }) Actor.timer.schedule(onTimeout.get, msec) - scheduler.managedBlock(blocker) - drainSendBuffer(mailbox) - // keep going - () => {} - } else - sys.error("unhandled timeout") + } + + // It is possible that !onTimeout.isEmpty, but TIMEOUT is not yet in mailbox + // See SI-4759 + waitingFor = f + received = None + isSuspended = true + scheduler.managedBlock(blocker) + drainSendBuffer(mailbox) + // keep going + () => {} } } todo() |