|
Public Methods |
| ACE_Dynamic_Message_Queue (ACE_Dynamic_Message_Strategy &message_strategy, size_t hwm=ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm=ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy *=0) |
virtual | ~ACE_Dynamic_Message_Queue (void) |
| Close down the message queue and release all resources.
|
virtual int | remove_messages (ACE_Message_Block *&list_head, ACE_Message_Block *&list_tail, u_int status_flags) |
virtual int | dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0) |
virtual void | dump (void) const |
| Dump the state of the queue.
|
virtual int | enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0) |
virtual int | enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0) |
Public Attributes |
| ACE_ALLOC_HOOK_DECLARE |
| Declare the dynamic allocation hooks.
|
Protected Methods |
virtual int | enqueue_i (ACE_Message_Block *new_item) |
virtual int | sublist_enqueue_i (ACE_Message_Block *new_item, const ACE_Time_Value ¤t_time, ACE_Message_Block *&sublist_head, ACE_Message_Block *&sublist_tail, ACE_Dynamic_Message_Strategy::Priority_Status status) |
| Enqueue a message in priority order within a given priority status sublist.
|
virtual int | dequeue_head_i (ACE_Message_Block *&first_item) |
virtual int | refresh_queue (const ACE_Time_Value ¤t_time) |
virtual int | refresh_pending_queue (const ACE_Time_Value ¤t_time) |
virtual int | refresh_late_queue (const ACE_Time_Value ¤t_time) |
Protected Attributes |
ACE_Message_Block * | pending_head_ |
| Pointer to head of the pending messages.
|
ACE_Message_Block * | pending_tail_ |
| Pointer to tail of the pending messages.
|
ACE_Message_Block * | late_head_ |
| Pointer to head of the late messages.
|
ACE_Message_Block * | late_tail_ |
| Pointer to tail of the late messages.
|
ACE_Message_Block * | beyond_late_head_ |
| Pointer to head of the beyond late messages.
|
ACE_Message_Block * | beyond_late_tail_ |
| Pointer to tail of the beyond late messages.
|
ACE_Dynamic_Message_Strategy & | message_strategy_ |
| Pointer to a dynamic priority evaluation function.
|
Private Methods |
void | operator= (const ACE_Dynamic_Message_Queue< _ACE_SYNCH > &) |
| ACE_Dynamic_Message_Queue (const ACE_Dynamic_Message_Queue< _ACE_SYNCH > &) |
virtual int | peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0) |
| Private method to hide public base class method: just calls base class method.
|
The messages in the queue are managed so as to preserve a logical ordering with minimal overhead per enqueue and dequeue operation. For this reason, the actual order of messages in the linked list of the queue may differ from their priority order. As time passes, a message may change from pending status to late status, and eventually to beyond late status. To minimize reordering overhead under this design force, three separate boundaries are maintained within the linked list of messages. Messages are dequeued preferentially from the head of the pending portion, then the head of the late portion, and finally from the head of the beyond late portion. In this way, only the boundaries need to be maintained (which can be done efficiently, as aging messages maintain the same linked list order as they progress from one status to the next), with no reordering of the messages themselves, while providing correct priority ordered dequeueing semantics. Head and tail enqueue methods inherited from ACE_Message_Queue are made private to prevent out-of-order messages from confusing management of the various portions of the queue. Messages in the pending portion of the queue whose priority becomes late (according to the specific dynamic strategy) advance into the late portion of the queue. Messages in the late portion of the queue whose priority becomes later than can be represented advance to the beyond_late portion of the queue. These behaviors support a limited schedule overrun, with pending messages prioritized ahead of late messages, and late messages ahead of beyond late messages. These behaviors can be modified in derived classes by providing alternative definitions for the appropriate virtual methods. When filled with messages, the queue's linked list should look like: H T | | B - B - B - B - L - L - L - P - P - P - P - P | | | | | | BH BT LH LT PH PT Where the symbols are as follows: H = Head of the entire list T = Tail of the entire list B = Beyond late message BH = Beyond late messages Head BT = Beyond late messages Tail L = Late message LH = Late messages Head LT = Late messages Tail P = Pending message PH = Pending messages Head PT = Pending messages Tail Caveat: the virtual methods enqueue_tail, enqueue_head, and peek_dequeue_head have semantics for the static message queues that cannot be guaranteed for dynamic message queues. The peek_dequeue_head method just calls the base class method, while the two enqueue methods call the priority enqueue method. The order of messages in the dynamic queue is a function of message deadlines and how long they are in the queues. You can manipulate these in some cases to ensure the correct semantics, but that is not a very stable or portable approach (discouraged).