Back off if another thread has processed all messages for this actor. See #3064

This commit is contained in:
Björn Antonsson 2013-02-27 15:45:40 +01:00
parent 52e1bb3d92
commit ccdee92961
2 changed files with 106 additions and 102 deletions

View file

@ -388,12 +388,15 @@ private[akka] trait DefaultSystemMessageQueue { self: Mailbox ⇒
}
@tailrec
final def systemDrain(newContents: SystemMessage): SystemMessage = {
val head = systemQueueGet
if (systemQueuePut(head, newContents)) SystemMessage.reverse(head) else systemDrain(newContents)
final def systemDrain(newContents: SystemMessage): SystemMessage = systemQueueGet match {
case NoMessage null
case head if (systemQueuePut(head, newContents)) SystemMessage.reverse(head) else systemDrain(newContents)
}
def hasSystemMessages: Boolean = systemQueueGet ne null
def hasSystemMessages: Boolean = systemQueueGet match {
case null | NoMessage false
case _ true
}
}