frost.unsafe

Class UnsafeMessageQueue<T>

    └ Immutable
         └ Object

A message queue which allows mutable objects to be passed between threads, violating the normal Frost assumption that a mutable object is accessible only from a single thread.

This is much more dangerous than one would assume at first glance, since any interaction with a mutable object passed between threads is dangerous. As Frost assumes that mutable objects are not shared between threads, it does not take any measures to ensure thread safety while refcounting objects that are known at compile time to be mutable. Even read-only multithreaded access to mutable objects can cause undefined behavior in the absence of very careful locking.

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.