frost.threads

Class MessageQueue<T:Immutable>

    └ Immutable
         └ Object

A queue which can be shared between multiple Threads, allowing any of them to submit messages to or pull messages out of it. Multiple threads may simultaneously wait for a message from the same message queue, in which case one of the waiting threads will be selected to receive the message in a system-dependent fashion, while the other threads will continue to wait.

Source Code:
View Source
Inherited Fields:

Instance Method Summary

post(data:T)
Posts an object to the queue.
pendingMessages():Int
Returns the number of messages currently in the queue.
hasMessage():Bit
Returns true if there are one or more messages in the queue.
getMessage():T
Returns the next message from the queue, blocking until one is available.
clear()
Remove all pending messages from the queue.

Instance Methods

method post (data:T)

Posts an object to the queue.

Parameters:
data - the object to post
method pendingMessages ():Int

Returns the number of messages currently in the queue.

Returns:
the number of messages in this MessageQueue
See also:
hasMessage()
getMessage()
method hasMessage ():Bit

Returns true if there are one or more messages in the queue.

Returns:
whether this queue has pending messages
See also:
pendingMessages()
getMessage()
method getMessage ():T

Returns the next message from the queue, blocking until one is available.

Returns:
the next message from the queue
method clear ()

Remove all pending messages from the queue.