Public Types | |
| typedef queue< T >::value_type | value_type |
| The type of datum stored in the queue. | |
| typedef queue< T >::size_type | size_type |
| The type used to represent the size of the queue. | |
Public Methods | |
| tqueue () | |
| Constructor. | |
| bool | empty () const |
| Returns true if the queue is empty. | |
| size_type | size () const |
| Returns the number of items in the queue. | |
| value_type & | front () |
| Returns the item at the head of the queue (least recently pushed). | |
| const value_type & | front () const |
| Returns the item at the head of the queue (least recently pushed). | |
| value_type & | back () |
| Returns the item at the tail of the queue (most recently pushed). | |
| const value_type & | back () const |
| Returns the item at the tail of the queue (most recently pushed). | |
| bool | push (const value_type &v) |
| Adds an item to the back of the queue. | |
| void | pop () |
| Removes an item from the front of the queue. | |
| T | get () |
| Returns and removes an item from the front of the queue. | |
| bool | wait (T &out, bool *pending=0) |
| Waits for the queue to become non-empty, then atomically retrieves an item from the queue, sets out, and returns true; or returns false if the queue has been closed. | |
| void | waiter_pending () |
| void | close () |
| Closes the queue so all pending and future calls to wait() will return immediately. | |
| void | starve () |
| Starves one waiter, causing its "wait" to return false. | |
| bool | is_closed () |
| Is the queue closed? | |
| unsigned int | count_waiters () |
| Returns the number of waiters on the thread. | |
| int | extra_capacity () |
| Returns the number of threads currently waiting on the queue (or zero if none) minus the number of elements waiting in the queue. | |
|
|||||
|
The type used to represent the size of the queue.
|
|
|||||
|
The type of datum stored in the queue.
|
|
|||||||||
|
Constructor.
|
|
|||||||||
|
Returns the item at the tail of the queue (most recently pushed).
|
|
|||||||||
|
Returns the item at the tail of the queue (most recently pushed).
|
|
|||||||||
|
Closes the queue so all pending and future calls to wait() will return immediately.
|
|
|||||||||
|
Returns the number of waiters on the thread.
|
|
|||||||||
|
Returns true if the queue is empty.
|
|
|||||||||
|
Returns the number of threads currently waiting on the queue (or zero if none) minus the number of elements waiting in the queue. Returns a positive number if there is an "overflow" of waiters, and a negative number if there is an "underflow" of waiters. |
|
|||||||||
|
Returns the item at the head of the queue (least recently pushed).
|
|
|||||||||
|
Returns the item at the head of the queue (least recently pushed).
|
|
|||||||||
|
Returns and removes an item from the front of the queue.
|
|
|||||||||
|
Is the queue closed?
|
|
|||||||||
|
Removes an item from the front of the queue.
|
|
||||||||||
|
Adds an item to the back of the queue. Returns true if the item will be immediately dispatched. |
|
|||||||||
|
Returns the number of items in the queue.
|
|
|||||||||
|
Starves one waiter, causing its "wait" to return false.
|
|
||||||||||||||||
|
Waits for the queue to become non-empty, then atomically retrieves an item from the queue, sets out, and returns true; or returns false if the queue has been closed.
|
|
|||||||||
|
|