ACE_Message_Queue<> Class Template ReferenceA message queueing facility with parameterized synchronization capability. ACE_Message_Queue is modeled after the queueing facilities in System V STREAMs. More...
Inheritance diagram for ACE_Message_Queue<>:
Collaboration diagram for ACE_Message_Queue<>:
Detailed Descriptiontemplate<ACE_SYNCH_DECL>
A message queueing facility with parameterized synchronization capability. ACE_Message_Queue is modeled after the queueing facilities in System V STREAMs.
|
typedef ACE_Message_Queue_Iterator<ACE_SYNCH_USE> ACE_Message_Queue<>::ITERATOR |
typedef ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE> ACE_Message_Queue<>::REVERSE_ITERATOR |
ACE_Message_Queue<>::ACE_Message_Queue | ( | size_t | hwm = ACE_Message_Queue_Base::DEFAULT_HWM , |
|
size_t | lwm = ACE_Message_Queue_Base::DEFAULT_LWM , |
|||
ACE_Notification_Strategy * | ns = 0 | |||
) |
Initialize an ACE_Message_Queue.
hwm | High water mark. Determines how many bytes can be stored in a queue before it's considered full. Supplier threads must block until the queue is no longer full. | |
lwm | Low water mark. Determines how many bytes must be in the queue before supplier threads are allowed to enqueue additional data. By default, the hwm equals lwm, which means that suppliers will be able to enqueue new messages as soon as a consumer removes any message from the queue. Making the low water mark smaller than the high water mark forces consumers to drain more messages from the queue before suppliers can enqueue new messages, which can minimize the "silly window syndrome." | |
ns | Notification strategy. Pointer to an object conforming to the ACE_Notification_Strategy interface. If set, the object's notify(void) method will be called each time data is added to this ACE_Message_Queue. |
virtual ACE_Message_Queue<>::~ACE_Message_Queue | ( | void | ) | [virtual] |
Releases all resources from the message queue and marks it deactivated.
ACE_Message_Queue<>::ACE_Message_Queue | ( | const ACE_Message_Queue< _ACE_SYNCH > & | ) | [private] |
virtual int ACE_Message_Queue<>::open | ( | size_t | hwm = ACE_Message_Queue_Base::DEFAULT_HWM , |
|
size_t | lwm = ACE_Message_Queue_Base::DEFAULT_LWM , |
|||
ACE_Notification_Strategy * | ns = 0 | |||
) | [virtual] |
Initialize an ACE_Message_Queue.
hwm | High water mark. Determines how many bytes can be stored in a queue before it's considered full. Supplier threads must block until the queue is no longer full. | |
lwm | Low water mark. Determines how many bytes must be in the queue before supplier threads are allowed to enqueue additional data. By default, the hwm equals lwm, which means that suppliers will be able to enqueue new messages as soon as a consumer removes any message from the queue. Making the low water mark smaller than the high water mark forces consumers to drain more messages from the queue before suppliers can enqueue new messages, which can minimize the "silly window syndrome." | |
ns | Notification strategy. Pointer to an object conforming to the ACE_Notification_Strategy interface. If set, the object's notify(void) method will be called each time data is added to this ACE_Message_Queue. |
virtual int ACE_Message_Queue<>::close | ( | void | ) | [virtual] |
Releases all resources from the message queue and marks it deactivated.
The | number of messages released from the queue; -1 on error. |
Implements ACE_Message_Queue_Base.
virtual int ACE_Message_Queue<>::flush | ( | void | ) | [virtual] |
Releases all resources from the message queue but does not mark it deactivated. This method holds the queue lock during this operation.
virtual int ACE_Message_Queue<>::flush_i | ( | void | ) | [virtual] |
Release all resources from the message queue but do not mark it as deactivated.
virtual int ACE_Message_Queue<>::peek_dequeue_head | ( | ACE_Message_Block *& | first_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Retrieve a pointer to the first ACE_Message_Block in the queue without removing it.
first_item | Reference to an ACE_Message_Block * that will point to the first block on the queue. The block remains on the queue until this or another thread dequeues it. | |
timeout | The absolute time the caller will wait until for a block to be queued. |
>0 | The number of ACE_Message_Blocks on the queue. | |
-1 | On failure. errno holds the reason. Common errno values are:
|
Implements ACE_Message_Queue_Base.
Reimplemented in ACE_Dynamic_Message_Queue<>.
virtual int ACE_Message_Queue<>::enqueue_prio | ( | ACE_Message_Block * | new_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Enqueue an ACE_Message_Block into the queue in accordance with the ACE_Message_Block's priority (0 is lowest priority). FIFO order is maintained when messages of the same priority are inserted consecutively.
new_item | Pointer to an ACE_Message_Block that will be added to the queue. The block's msg_priority() method will be called to obtain the queueing priority. | |
timeout | The absolute time the caller will wait until for the block to be queued. |
>0 | The number of ACE_Message_Blocks on the queue after adding the specified block. | |
-1 | On failure. errno holds the reason. Common errno values are:
|
virtual int ACE_Message_Queue<>::enqueue_deadline | ( | ACE_Message_Block * | new_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Enqueue an ACE_Message_Block into the queue in accordance with the block's deadline time. FIFO order is maintained when messages of the same deadline time are inserted consecutively.
new_item | Pointer to an ACE_Message_Block that will be added to the queue. The block's msg_deadline_time() method will be called to obtain the relative queueing position. | |
timeout | The absolute time the caller will wait until for the block to be queued. |
>0 | The number of ACE_Message_Blocks on the queue after adding the specified block. | |
-1 | On failure. errno holds the reason. Common errno values are:
|
virtual int ACE_Message_Queue<>::enqueue | ( | ACE_Message_Block * | new_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Implements ACE_Message_Queue_Base.
virtual int ACE_Message_Queue<>::enqueue_tail | ( | ACE_Message_Block * | new_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Enqueue one or more ACE_Message_Block objects at the tail of the queue. If the new_item next()
pointer is non-zero, it is assumed to be the start of a series of ACE_Message_Block objects connected via their next()
pointers. The series of blocks will be added to the queue in the same order they are passed in as.
new_item | Pointer to an ACE_Message_Block that will be added to the queue. If the block's next() pointer is non-zero, all blocks chained from the next() pointer are enqueued as well. | |
timeout | The absolute time the caller will wait until for the block to be queued. |
>0 | The number of ACE_Message_Blocks on the queue after adding the specified block(s). | |
-1 | On failure. errno holds the reason. Common errno values are:
|
Implements ACE_Message_Queue_Base.
Reimplemented in ACE_Dynamic_Message_Queue<>.
virtual int ACE_Message_Queue<>::enqueue_head | ( | ACE_Message_Block * | new_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Enqueue one or more ACE_Message_Block objects at the head of the queue. If the new_item next()
pointer is non-zero, it is assumed to be the start of a series of ACE_Message_Block objects connected via their next()
pointers. The series of blocks will be added to the queue in the same order they are passed in as.
new_item | Pointer to an ACE_Message_Block that will be added to the queue. If the block's next() pointer is non-zero, all blocks chained from the next() pointer are enqueued as well. | |
timeout | The absolute time the caller will wait until for the block to be queued. |
>0 | The number of ACE_Message_Blocks on the queue after adding the specified block(s). | |
-1 | On failure. errno holds the reason. Common errno values are:
|
Reimplemented in ACE_Dynamic_Message_Queue<>.
virtual int ACE_Message_Queue<>::dequeue | ( | ACE_Message_Block *& | first_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
virtual int ACE_Message_Queue<>::dequeue_head | ( | ACE_Message_Block *& | first_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Dequeue the ACE_Message_Block at the head of the queue and return a pointer to the dequeued block.
first_item | Reference to an ACE_Message_Block * that will be set to the address of the dequeued block. | |
timeout | The absolute time the caller will wait until for a block to be dequeued. |
>=0 | The number of ACE_Message_Blocks remaining in the queue. | |
-1 | On failure. errno holds the reason. Common errno values are:
|
Implements ACE_Message_Queue_Base.
Reimplemented in ACE_Dynamic_Message_Queue<>.
virtual int ACE_Message_Queue<>::dequeue_prio | ( | ACE_Message_Block *& | first_item, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Dequeue the ACE_Message_Block that has the lowest priority (preserves FIFO order for messages with the same priority) and return a pointer to the dequeued block.
first_item | Reference to an ACE_Message_Block * that will be set to the address of the dequeued block. | |
timeout | The absolute time the caller will wait until for a block to be dequeued. |
>=0 | The number of ACE_Message_Blocks remaining in the queue. | |
-1 | On failure. errno holds the reason. Common errno values are:
|
virtual int ACE_Message_Queue<>::dequeue_tail | ( | ACE_Message_Block *& | dequeued, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Dequeue the ACE_Message_Block at the tail of the queue and return a pointer to the dequeued block.
dequeued | Reference to an ACE_Message_Block * that will be set to the address of the dequeued block. | |
timeout | The absolute time the caller will wait until for a block to be dequeued. |
>=0 | The number of ACE_Message_Blocks remaining in the queue. | |
-1 | On failure. errno holds the reason. Common errno values are:
|
virtual int ACE_Message_Queue<>::dequeue_deadline | ( | ACE_Message_Block *& | dequeued, | |
ACE_Time_Value * | timeout = 0 | |||
) | [virtual] |
Dequeue the ACE_Message_Block with the earliest deadline time and return a pointer to the dequeued block.
dequeued | Reference to an ACE_Message_Block * that will be set to the address of the dequeued block. | |
timeout | The absolute time the caller will wait until for a block to be dequeued. |
>=0 | The number of ACE_Message_Blocks remaining in the queue. | |
-1 | On failure. errno holds the reason. Common errno values are:
|
virtual bool ACE_Message_Queue<>::is_full | ( | void | ) | [virtual] |
virtual bool ACE_Message_Queue<>::is_empty | ( | void | ) | [virtual] |
virtual size_t ACE_Message_Queue<>::message_bytes | ( | void | ) | [virtual] |
Number of total bytes on the queue, i.e., sum of the message block sizes.
Implements ACE_Message_Queue_Base.
virtual size_t ACE_Message_Queue<>::message_length | ( | void | ) | [virtual] |
Number of total length on the queue, i.e., sum of the message block lengths.
Implements ACE_Message_Queue_Base.
virtual size_t ACE_Message_Queue<>::message_count | ( | void | ) | [virtual] |
Number of total messages on the queue.
Implements ACE_Message_Queue_Base.
virtual void ACE_Message_Queue<>::message_bytes | ( | size_t | new_size | ) | [virtual] |
New value of the number of total bytes on the queue, i.e., sum of the message block sizes.
Implements ACE_Message_Queue_Base.
virtual void ACE_Message_Queue<>::message_length | ( | size_t | new_length | ) | [virtual] |
New value of the number of total length on the queue, i.e., sum of the message block lengths.
Implements ACE_Message_Queue_Base.
virtual size_t ACE_Message_Queue<>::high_water_mark | ( | void | ) | [virtual] |
Get high watermark.
virtual void ACE_Message_Queue<>::high_water_mark | ( | size_t | hwm | ) | [virtual] |
Set the high watermark, which determines how many bytes can be stored in a queue before it's considered "full."
virtual size_t ACE_Message_Queue<>::low_water_mark | ( | void | ) | [virtual] |
Get low watermark.
virtual void ACE_Message_Queue<>::low_water_mark | ( | size_t | lwm | ) | [virtual] |
Set the low watermark, which determines how many bytes must be in the queue before supplier threads are allowed to enqueue additional ACE_Message_Blocks.
virtual int ACE_Message_Queue<>::deactivate | ( | void | ) | [virtual] |
Deactivate the queue and wakeup all threads waiting on the queue so they can continue. No messages are removed from the queue, however. Any other operations called until the queue is activated again will immediately return -1 with errno
== ESHUTDOWN. Returns WAS_INACTIVE if queue was inactive before the call and WAS_ACTIVE if queue was active before the call.
Implements ACE_Message_Queue_Base.
virtual int ACE_Message_Queue<>::activate | ( | void | ) | [virtual] |
Reactivate the queue so that threads can enqueue and dequeue messages again. Returns the state of the queue before the call.
Implements ACE_Message_Queue_Base.
virtual int ACE_Message_Queue<>::pulse | ( | void | ) | [virtual] |
Pulse the queue to wake up any waiting threads. Changes the queue state to PULSED; future enqueue/dequeue operations proceed as in ACTIVATED state.
Implements ACE_Message_Queue_Base.
virtual int ACE_Message_Queue<>::state | ( | void | ) | [virtual] |
Returns the current state of the queue, which can be one of ACTIVATED, DEACTIVATED, or PULSED.
Reimplemented from ACE_Message_Queue_Base.
virtual int ACE_Message_Queue<>::deactivated | ( | void | ) | [virtual] |
Returns true if the state of the queue is <DEACTIVATED>, but false if the queue's is <ACTIVATED> or <PULSED>.
Implements ACE_Message_Queue_Base.
virtual int ACE_Message_Queue<>::notify | ( | void | ) | [virtual] |
This hook is automatically invoked by <enqueue_head>, <enqueue_tail>, and <enqueue_prio> when a new item is inserted into the queue. Subclasses can override this method to perform specific notification strategies (e.g., signaling events for a <WFMO_Reactor>, notifying a <Reactor>, etc.). In a multi-threaded application with concurrent consumers, there is no guarantee that the queue will be still be non-empty by the time the notification occurs.
virtual ACE_Notification_Strategy* ACE_Message_Queue<>::notification_strategy | ( | void | ) | [virtual] |
virtual void ACE_Message_Queue<>::notification_strategy | ( | ACE_Notification_Strategy * | s | ) | [virtual] |
virtual ACE_SYNCH_MUTEX_T& ACE_Message_Queue<>::lock | ( | void | ) | [virtual] |
Returns a reference to the lock used by the ACE_Message_Queue.
virtual void ACE_Message_Queue<>::dump | ( | void | ) | const [virtual] |
Dump the state of an object.
Implements ACE_Message_Queue_Base.
Reimplemented in ACE_Dynamic_Message_Queue<>.
virtual int ACE_Message_Queue<>::enqueue_i | ( | ACE_Message_Block * | new_item | ) | [protected, virtual] |
Enqueue an <ACE_Message_Block *> in accordance with its priority.
Reimplemented in ACE_Dynamic_Message_Queue<>.
virtual int ACE_Message_Queue<>::enqueue_deadline_i | ( | ACE_Message_Block * | new_item | ) | [protected, virtual] |
Enqueue an <ACE_Message_Block *> in accordance with its deadline time.
virtual int ACE_Message_Queue<>::enqueue_tail_i | ( | ACE_Message_Block * | new_item | ) | [protected, virtual] |
Enqueue an <ACE_Message_Block *> at the end of the queue.
virtual int ACE_Message_Queue<>::enqueue_head_i | ( | ACE_Message_Block * | new_item | ) | [protected, virtual] |
Enqueue an <ACE_Message_Block *> at the head of the queue.
virtual int ACE_Message_Queue<>::dequeue_head_i | ( | ACE_Message_Block *& | first_item | ) | [protected, virtual] |
Dequeue and return the <ACE_Message_Block *> at the head of the queue.
Reimplemented in ACE_Dynamic_Message_Queue<>.
virtual int ACE_Message_Queue<>::dequeue_prio_i | ( | ACE_Message_Block *& | dequeued | ) | [protected, virtual] |
Dequeue and return the <ACE_Message_Block *> with the lowest priority.
virtual int ACE_Message_Queue<>::dequeue_tail_i | ( | ACE_Message_Block *& | first_item | ) | [protected, virtual] |
Dequeue and return the <ACE_Message_Block *> at the tail of the queue.
virtual int ACE_Message_Queue<>::dequeue_deadline_i | ( | ACE_Message_Block *& | first_item | ) | [protected, virtual] |
Dequeue and return the <ACE_Message_Block *> with the lowest deadline time.
virtual bool ACE_Message_Queue<>::is_full_i | ( | void | ) | [protected, virtual] |
True if queue is full, else false.
virtual bool ACE_Message_Queue<>::is_empty_i | ( | void | ) | [protected, virtual] |
True if queue is empty, else false.
virtual int ACE_Message_Queue<>::deactivate_i | ( | int | pulse = 0 |
) | [protected, virtual] |
Notifies all waiting threads that the queue has been deactivated so they can wakeup and continue other processing. No messages are removed from the queue.
pulse | If 0, the queue's state is changed to DEACTIVATED and any other operations called until the queue is reactivated will immediately return -1 with errno == ESHUTDOWN. If not zero, only the waiting threads are notified and the queue's state changes to PULSED. |
virtual int ACE_Message_Queue<>::activate_i | ( | void | ) | [protected, virtual] |
Activate the queue.
virtual int ACE_Message_Queue<>::wait_not_full_cond | ( | ACE_Guard< ACE_SYNCH_MUTEX_T > & | mon, | |
ACE_Time_Value * | timeout | |||
) | [protected, virtual] |
Wait for the queue to become non-full.
virtual int ACE_Message_Queue<>::wait_not_empty_cond | ( | ACE_Guard< ACE_SYNCH_MUTEX_T > & | mon, | |
ACE_Time_Value * | timeout | |||
) | [protected, virtual] |
Wait for the queue to become non-empty.
virtual int ACE_Message_Queue<>::signal_enqueue_waiters | ( | void | ) | [protected, virtual] |
Inform any threads waiting to enqueue that they can procede.
virtual int ACE_Message_Queue<>::signal_dequeue_waiters | ( | void | ) | [protected, virtual] |
Inform any threads waiting to dequeue that they can procede.
void ACE_Message_Queue<>::operator= | ( | const ACE_Message_Queue< _ACE_SYNCH > & | ) | [private] |
Sends the size of the queue whenever it changes.
friend class ACE_Message_Queue_Iterator< ACE_SYNCH_USE > [friend] |
friend class ACE_Message_Queue_Reverse_Iterator< ACE_SYNCH_USE > [friend] |
ACE_Message_Queue<>::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
Reimplemented from ACE_Message_Queue_Base.
Reimplemented in ACE_Dynamic_Message_Queue<>.
ACE_Message_Block* ACE_Message_Queue<>::head_ [protected] |
Pointer to head of ACE_Message_Block list.
ACE_Message_Block* ACE_Message_Queue<>::tail_ [protected] |
Pointer to tail of ACE_Message_Block list.
size_t ACE_Message_Queue<>::low_water_mark_ [protected] |
Lowest number before unblocking occurs.
size_t ACE_Message_Queue<>::high_water_mark_ [protected] |
Greatest number of bytes before blocking.
size_t ACE_Message_Queue<>::cur_bytes_ [protected] |
Current number of bytes in the queue.
size_t ACE_Message_Queue<>::cur_length_ [protected] |
Current length of messages in the queue.
size_t ACE_Message_Queue<>::cur_count_ [protected] |
Current number of messages in the queue.
ACE_Notification_Strategy* ACE_Message_Queue<>::notification_strategy_ [protected] |
The notification strategy used when a new message is enqueued.
ACE_SYNCH_MUTEX_T ACE_Message_Queue<>::lock_ [protected] |
Protect queue from concurrent access.
ACE_SYNCH_CONDITION_T ACE_Message_Queue<>::not_empty_cond_ [protected] |
Used to make threads sleep until the queue is no longer empty.
ACE_SYNCH_CONDITION_T ACE_Message_Queue<>::not_full_cond_ [protected] |
Used to make threads sleep until the queue is no longer full.