1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
|
.TH ACE_Message_Queue_Ex 3 "1 Dec 2001" "ACE" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ACE_Message_Queue_Ex \- A threaded message queueing facility, modeled after the queueing facilities in System V STREAMs.
.SH SYNOPSIS
.br
.PP
\fC#include <Message_Queue_T.h>\fR
.PP
.SS Public Types
.in +1c
.ti -1c
.RI "enum { \fBDEFAULT_PRIORITY\fR = 0 }"
.br
.in -1c
.SS Public Methods
.in +1c
.ti -1c
.RI "\fBACE_Message_Queue_Ex\fR (size_t high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM, size_t low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM, \fBACE_Notification_Strategy\fR * = 0)"
.br
.ti -1c
.RI "virtual int \fBopen\fR (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM, \fBACE_Notification_Strategy\fR * = 0)"
.br
.ti -1c
.RI "virtual int \fBclose\fR (void)"
.br
.RI "\fIClose down the message queue and release all resources.\fR"
.ti -1c
.RI "virtual \fB~ACE_Message_Queue_Ex\fR (void)"
.br
.RI "\fIClose down the message queue and release all resources.\fR"
.ti -1c
.RI "virtual int \fBpeek_dequeue_head\fR (ACE_MESSAGE_TYPE *&first_item, \fBACE_Time_Value\fR *timeout = 0)"
.br
.ti -1c
.RI "virtual int \fBenqueue_prio\fR (ACE_MESSAGE_TYPE *new_item, \fBACE_Time_Value\fR *timeout = 0)"
.br
.ti -1c
.RI "virtual int \fBenqueue\fR (ACE_MESSAGE_TYPE *new_item, \fBACE_Time_Value\fR *timeout = 0)"
.br
.ti -1c
.RI "virtual int \fBenqueue_tail\fR (ACE_MESSAGE_TYPE *new_item, \fBACE_Time_Value\fR *timeout = 0)"
.br
.ti -1c
.RI "virtual int \fBenqueue_head\fR (ACE_MESSAGE_TYPE *new_item, \fBACE_Time_Value\fR *timeout = 0)"
.br
.ti -1c
.RI "virtual int \fBdequeue\fR (ACE_MESSAGE_TYPE *&first_item, \fBACE_Time_Value\fR *timeout = 0)"
.br
.RI "\fIThis method is an alias for the following <dequeue_head> method.\fR"
.ti -1c
.RI "virtual int \fBdequeue_head\fR (ACE_MESSAGE_TYPE *&first_item, \fBACE_Time_Value\fR *timeout = 0)"
.br
.ti -1c
.RI "virtual int \fBis_full\fR (void)"
.br
.RI "\fITrue if queue is full, else false.\fR"
.ti -1c
.RI "virtual int \fBis_empty\fR (void)"
.br
.RI "\fITrue if queue is empty, else false.\fR"
.ti -1c
.RI "virtual size_t \fBmessage_bytes\fR (void)"
.br
.ti -1c
.RI "virtual size_t \fBmessage_length\fR (void)"
.br
.ti -1c
.RI "virtual size_t \fBmessage_count\fR (void)"
.br
.ti -1c
.RI "virtual void \fBmessage_bytes\fR (size_t new_size)"
.br
.ti -1c
.RI "virtual void \fBmessage_length\fR (size_t new_length)"
.br
.ti -1c
.RI "virtual size_t \fBhigh_water_mark\fR (void)"
.br
.ti -1c
.RI "virtual void \fBhigh_water_mark\fR (size_t hwm)"
.br
.ti -1c
.RI "virtual size_t \fBlow_water_mark\fR (void)"
.br
.ti -1c
.RI "virtual void \fBlow_water_mark\fR (size_t lwm)"
.br
.ti -1c
.RI "virtual int \fBdeactivate\fR (void)"
.br
.ti -1c
.RI "virtual int \fBactivate\fR (void)"
.br
.ti -1c
.RI "virtual int \fBdeactivated\fR (void)"
.br
.RI "\fIReturns true if <deactivated_> is enabled.\fR"
.ti -1c
.RI "virtual int \fBnotify\fR (void)"
.br
.ti -1c
.RI "virtual \fBACE_Notification_Strategy\fR* \fBnotification_strategy\fR (void)"
.br
.RI "\fIGet/set the notification strategy for the <Message_Queue>.\fR"
.ti -1c
.RI "virtual void \fBnotification_strategy\fR (\fBACE_Notification_Strategy\fR *s)"
.br
.ti -1c
.RI "virtual ACE_SYNCH_MUTEX_T& \fBlock\fR (void)"
.br
.RI "\fIReturns a reference to the lock used by the .\fR"
.ti -1c
.RI "virtual void \fBdump\fR (void) const"
.br
.RI "\fIDump the state of an object.\fR"
.in -1c
.SS Public Attributes
.in +1c
.ti -1c
.RI "\fBACE_ALLOC_HOOK_DECLARE\fR"
.br
.RI "\fIDeclare the dynamic allocation hooks.\fR"
.in -1c
.SS Private Attributes
.in +1c
.ti -1c
.RI "\fBACE_Message_Queue\fR<ACE_SYNCH_USE> \fBqueue_\fR"
.br
.RI "\fIImplement this via an .\fR"
.in -1c
.SH DETAILED DESCRIPTION
.PP
.SS template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> template class ACE_Message_Queue_Ex
A threaded message queueing facility, modeled after the queueing facilities in System V STREAMs.
.PP
.PP
An is a strongly-typed version of the . If is then all operations are thread-safe. Otherwise, if it's then there's no locking overhead.
.PP
.SH MEMBER ENUMERATION DOCUMENTATION
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> anonymous enum
.PP
\fBEnumeration values:\fR
.in +1c
.TP
\fB\fIDEFAULT_PRIORITY\fR \fR
.SH CONSTRUCTOR & DESTRUCTOR DOCUMENTATION
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, > (size_t high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM, size_t low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM, \fBACE_Notification_Strategy\fR * = 0)
.PP
Initialize an . The <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. The <low_water_mark> determines how many bytes must be in the queue before supplier threads are allowed to enqueue additional s. By default, the <high_water_mark> equals the <low_water_mark>, 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."
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::~ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, > (void)\fC [virtual]\fR
.PP
Close down the message queue and release all resources.
.PP
.SH MEMBER FUNCTION DOCUMENTATION
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::activate (void)\fC [virtual]\fR
.PP
Reactivate the queue so that threads can enqueue and dequeue messages again. Returns WAS_INACTIVE if queue was inactive before the call and WAS_ACTIVE if queue was active before the call.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::close (void)\fC [virtual]\fR
.PP
Close down the message queue and release all resources.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::deactivate (void)\fC [virtual]\fR
.PP
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.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::deactivated (void)\fC [virtual]\fR
.PP
Returns true if <deactivated_> is enabled.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::dequeue (ACE_MESSAGE_TYPE *& first_item, \fBACE_Time_Value\fR * timeout = 0)\fC [virtual]\fR
.PP
This method is an alias for the following <dequeue_head> method.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::dequeue_head (ACE_MESSAGE_TYPE *& first_item, \fBACE_Time_Value\fR * timeout = 0)\fC [virtual]\fR
.PP
Dequeue and return the at the head of the queue. Note that <timeout> uses <{absolute}> time rather than <{relative}> time. If the <timeout> elapses without receiving a message -1 is returned and <errno> is set to <EWOULDBLOCK>. If the queue is deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number of items still on the queue.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::dump (void) const\fC [virtual]\fR
.PP
Dump the state of an object.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::enqueue (ACE_MESSAGE_TYPE * new_item, \fBACE_Time_Value\fR * timeout = 0)\fC [virtual]\fR
.PP
This is an alias for <enqueue_prio>. It's only here for backwards compatibility and will go away in a subsequent release. Please use <enqueue_prio> instead. Note that <timeout> uses <{absolute}> time rather than <{relative}> time.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::enqueue_head (ACE_MESSAGE_TYPE * new_item, \fBACE_Time_Value\fR * timeout = 0)\fC [virtual]\fR
.PP
Enqueue an at the head of the queue. Note that <timeout> uses <{absolute}> time rather than <{relative}> time. If the <timeout> elapses without receiving a message -1 is returned and <errno> is set to <EWOULDBLOCK>. If the queue is deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number of items still on the queue.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::enqueue_prio (ACE_MESSAGE_TYPE * new_item, \fBACE_Time_Value\fR * timeout = 0)\fC [virtual]\fR
.PP
Enqueue an into the <Message_Queue> in accordance with its <msg_priority> (0 is lowest priority). FIFO order is maintained when messages of the same priority are inserted consecutively. Note that <timeout> uses <{absolute}> time rather than <{relative}> time. If the <timeout> elapses without receiving a message -1 is returned and <errno> is set to <EWOULDBLOCK>. If the queue is deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number of items still on the queue.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::enqueue_tail (ACE_MESSAGE_TYPE * new_item, \fBACE_Time_Value\fR * timeout = 0)\fC [virtual]\fR
.PP
Enqueue an at the end of the queue. Note that <timeout> uses <{absolute}> time rather than <{relative}> time. If the <timeout> elapses without receiving a message -1 is returned and <errno> is set to <EWOULDBLOCK>. If the queue is deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number of items still on the queue.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::high_water_mark (size_t hwm)\fC [virtual]\fR
.PP
Set the high watermark, which determines how many bytes can be stored in a queue before it's considered "full."
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::high_water_mark (void)\fC [virtual]\fR
.PP
Get high watermark.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::is_empty (void)\fC [virtual]\fR
.PP
True if queue is empty, else false.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::is_full (void)\fC [virtual]\fR
.PP
True if queue is full, else false.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> ACE_SYNCH_MUTEX_T & ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::lock (void)\fC [inline, virtual]\fR
.PP
Returns a reference to the lock used by the .
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::low_water_mark (size_t lwm)\fC [virtual]\fR
.PP
Set the low watermark, which determines how many bytes must be in the queue before supplier threads are allowed to enqueue additional s.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::low_water_mark (void)\fC [virtual]\fR
.PP
Get low watermark.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::message_bytes (size_t new_size)\fC [virtual]\fR
.PP
New value of the number of total bytes on the queue, i.e., sum of the message block sizes.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::message_bytes (void)\fC [virtual]\fR
.PP
Number of total bytes on the queue, i.e., sum of the message block sizes.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::message_count (void)\fC [virtual]\fR
.PP
Number of total messages on the queue.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::message_length (size_t new_length)\fC [virtual]\fR
.PP
New value of the number of total length on the queue, i.e., sum of the message block lengths.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::message_length (void)\fC [virtual]\fR
.PP
Number of total length on the queue, i.e., sum of the message block lengths.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> virtual void ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::notification_strategy (\fBACE_Notification_Strategy\fR * s)\fC [virtual]\fR
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> \fBACE_Notification_Strategy\fR * ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::notification_strategy (void)\fC [virtual]\fR
.PP
Get/set the notification strategy for the <Message_Queue>.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::notify (void)\fC [virtual]\fR
.PP
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.
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::open (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM, \fBACE_Notification_Strategy\fR * = 0)\fC [virtual]\fR
.PP
Initialize an . The <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. The <low_water_mark> determines how many bytes must be in the queue before supplier threads are allowed to enqueue additional s. By default, the <high_water_mark> equals the <low_water_mark>, 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."
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::peek_dequeue_head (ACE_MESSAGE_TYPE *& first_item, \fBACE_Time_Value\fR * timeout = 0)\fC [virtual]\fR
.PP
Retrieve the first without removing it. Note that <timeout> uses <{absolute}> time rather than <{relative}> time. If the <timeout> elapses without receiving a message -1 is returned and <errno> is set to <EWOULDBLOCK>. If the queue is deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number of items still on the queue.
.SH MEMBER DATA DOCUMENTATION
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::ACE_ALLOC_HOOK_DECLARE
.PP
Declare the dynamic allocation hooks.
.PP
.SS template<classACE_MESSAGE_TYPE, ACE_SYNCH_DECL> \fBACE_Message_Queue\fR< ACE_SYNCH_USE > ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, >::queue_\fC [private]\fR
.PP
Implement this via an .
.PP
.SH AUTHOR
.PP
Generated automatically by Doxygen for ACE from the source code.
|