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
Instance Method Summary
- Posts an object to the queue.
- Returns the number of messages currently in the queue.
trueif there are one or more messages in the queue.
- Returns the next message from the queue, blocking until one is available.
- Remove all pending messages from the queue.
method post ( data:
Posts an object to the queue.
data the object to post
method pendingMessages ():
method hasMessage ():
method getMessage ():
Returns the next message from the queue, blocking until one is available.
- the next message from the queue
method clear ()
Remove all pending messages from the queue.