Signaler of relevant processing conditions.
Class SyncQueue from \ Waitable( )
This class implements a synchronized Falcon items FIFO or LIFO queue that can be waited on for non-empty status.
A single waiting thread will acquire the queue when it is not empty; at that point, it can dequeue one or more items being previously pushed, released the queue and processed the dequeued items.
Holding the queue in acquired status prevents concurrent insertion of new items, as well as removal, so it's advisable to release the queue as soon as possible, that is, as soon as the items that must be processed are retrieved.
Note: Always remember that items in the queue are serialized copies coming from the pushing VMs. Serialization is a relatively expensive operation for non-simple types, and may cause error raising if the pushed items are not serializable.
Methods | |
empty | Returns true if the queue is empty. |
pop | Pops an item from the back of the queue. |
popFront | Pops an item from the front of the queue. |
push | Pushes an item at the end of the queue. |
pushFront | Pushes an item in front of the queue. |
size | Returns the count of elements currently stored in the queue. |
Methods inherited from class Waitable | |
release | Releases a structure acquired by a waiting function. |
Returns true if the queue is empty.
SyncQueue.empty()
Return | True if the queue is empty. |
Although it is possible to call this method in any moment, it is consistent to call it only when the queue has been acquired through a succesful wait.
Pops an item from the back of the queue.
SyncQueue.pop()
Return | The item that was at the end of the queue. | ||
Raise |
|
This method removes an item from the end of the queue and returns it to the caller.
Pops an item from the front of the queue.
SyncQueue.popFront()
Return | The item that was in front of the queue. | ||
Raise |
|
This method removes an item in front of the queue and returns it to the caller.
Pushes an item at the end of the queue.
SyncQueue.push( item )
item | The item to be pushed | ||
Raise |
|
This method adds an item at the end of the queue. If the queue was empty, waiting threads may be signaled to receive the added item.
The item parameter must be a serializable item, or a CodeError will be raised.
Pushes an item in front of the queue.
SyncQueue.pushFront( item )
item | The item to be pushed | ||
Raise |
|
This method adds an item in front of the queue. If the queue was empty, waiting threads may be signaled to receive the added item.
The item parameter must be a serializable item, or a CodeError will be raised.
Returns the count of elements currently stored in the queue.
SyncQueue.size()
Return | Number of elements currently held in the queue. |
Although it is possible to call this method in any moment, it is consistent to call it only when the queue has been acquired through a succesful wait.