Enforing an acknowledgement of the mailbox status after each message has been processed

This commit is contained in:
Viktor Klang 2011-09-26 15:45:24 +02:00
parent c2a8e8d6a6
commit d8d639e259
2 changed files with 16 additions and 10 deletions

View file

@ -40,6 +40,16 @@ abstract class Mailbox extends MessageQueue with SystemMessageQueue with Runnabl
final def isClosed: Boolean = status == Closed
final def isOpen: Boolean = status == Open
/**
* Internal method to enforce a volatile write of the status
*/
@tailrec
final def acknowledgeStatus(): Unit = {
val s = _status.get()
if (_status.compareAndSet(s, s)) ()
else acknowledgeStatus()
}
def become(newStatus: Status): Boolean = {
@tailrec
def transcend(): Boolean = {