ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL > Class Template Reference

A threaded message queueing facility, modeled after the queueing facilities in System V STREAMs. More...

#include <Message_Queue_T.h>

Collaboration diagram for ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >:

Collaboration graph
[legend]

List of all members.

Public Types

enum  { DEFAULT_PRIORITY = 0 }
typedef
ACE_Message_Queue_Ex_Iterator
< ACE_MESSAGE_TYPE,
ACE_SYNCH_USE > 
ITERATOR
typedef
ACE_Message_Queue_Ex_Reverse_Iterator
< ACE_MESSAGE_TYPE,
ACE_SYNCH_USE > 
REVERSE_ITERATOR

Public Member Functions

virtual int close (void)
virtual ~ACE_Message_Queue_Ex (void)
 Releases all resources from the message queue and marks it deactivated.
virtual int flush (void)
virtual int flush_i (void)
virtual ACE_SYNCH_MUTEX_T & lock (void)
 Returns a reference to the lock used by the ACE_Message_Queue_Ex.
virtual void dump (void) const
 Dump the state of an object.
Initialization methods
 ACE_Message_Queue_Ex (size_t high_water_mark=ACE_Message_Queue_Base::DEFAULT_HWM, size_t low_water_mark=ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy *ns=0)
virtual int open (size_t hwm=ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm=ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy *=0)
Enqueue and dequeue methods
The enqueue and dequeue methods accept a timeout value passed as an ACE_Time_Value *. In all cases, if the timeout pointer is 0, the caller will block until action is possible. If the timeout pointer is non-zero, the call will wait (if needed, subject to water mark settings) until the absolute time specified in the referenced ACE_Time_Value object is reached. If the time is reached before the desired action is possible, the method will return -1 with errno set to EWOULDBLOCK. Regardless of the timeout setting, however, these methods will also fail and return -1 when the queue is closed, deactivated, pulsed, or when a signal occurs.

The time parameters are handled the same as in ACE_Message_Queue, so you can see C++NPv2 Section 6.2 and APG Section 12.3 for a fuller treatment of ACE_Message_Queue, enqueueing, dequeueing, and how these operations are affected by queue state transitions.

virtual int peek_dequeue_head (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout=0)
virtual int enqueue_prio (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0, unsigned long priority=DEFAULT_PRIORITY)
virtual int enqueue_deadline (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0)
virtual int enqueue (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0)
virtual int enqueue_tail (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0)
virtual int enqueue_head (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0)
virtual int dequeue (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout=0)
 This method is an alias for the following <dequeue_head> method.
virtual int dequeue_head (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout=0)
virtual int dequeue_prio (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout=0)
virtual int dequeue_tail (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout=0)
virtual int dequeue_deadline (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout=0)
Queue statistics methods
virtual bool is_full (void)
 True if queue is full, else false.
virtual bool is_empty (void)
 True if queue is empty, else false.
virtual size_t message_bytes (void)
virtual size_t message_length (void)
virtual size_t message_count (void)
virtual void message_bytes (size_t new_size)
virtual void message_length (size_t new_length)
Water mark (flow control) methods
virtual size_t high_water_mark (void)
virtual void high_water_mark (size_t hwm)
virtual size_t low_water_mark (void)
virtual void low_water_mark (size_t lwm)
Activation and queue state methods
See C++NPv2 Section 6.2 and APG Section 12.3 for a fuller treatment of queue states and transitions and how the transitions affect message enqueueing and dequeueing operations.

virtual int deactivate (void)
virtual int activate (void)
virtual int pulse (void)
virtual int state (void)
virtual int deactivated (void)
Notification strategy methods
virtual int notify (void)
virtual ACE_Notification_Strategynotification_strategy (void)
 Get the notification strategy for the <Message_Queue>.
virtual void notification_strategy (ACE_Notification_Strategy *s)
 Set the notification strategy for the <Message_Queue>.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Attributes

ACE_Message_Queue< ACE_SYNCH_USE > queue_
 Implement this via an ACE_Message_Queue.

Friends

class ACE_Message_Queue_Ex_Iterator< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >
class ACE_Message_Queue_Ex_Reverse_Iterator< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >


Detailed Description

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL>
class ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >

A threaded message queueing facility, modeled after the queueing facilities in System V STREAMs.

ACE_Message_Queue_Ex is a strongly-typed version of the ACE_Message_Queue class. Rather than queueing in terms of ACE_Message_Block objects, ACE_Message_Queue_Ex has a template argument to specify the type of objects that are queued.

The second template argument parameterizes the queue's synchronization. The argument specifies a synchronization strategy. The two main strategies available for ACE_SYNCH_DECL are:

  1. ACE_MT_SYNCH: all operations are thread-safe
  2. ACE_NULL_SYNCH: no synchronization and no locking overhead

Member Typedef Documentation

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
typedef ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::ITERATOR

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
typedef ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::REVERSE_ITERATOR


Member Enumeration Documentation

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
anonymous enum

Enumerator:
DEFAULT_PRIORITY  Default priority value. This is the lowest priority.


Constructor & Destructor Documentation

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::ACE_Message_Queue_Ex ( size_t  high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM,
size_t  low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy ns = 0 
)

Initialize an ACE_Message_Queue_Ex.

Parameters:
high_water_mark 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.
low_water_mark 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.
See also:
ACE_Reactor_Notification_Strategy.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::~ACE_Message_Queue_Ex ( void   )  [virtual]

Releases all resources from the message queue and marks it deactivated.


Member Function Documentation

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::activate ( void   )  [virtual]

Reactivate the queue so that threads can enqueue and dequeue messages again. Returns the state of the queue before the call.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::close ( void   )  [virtual]

Releases all resources from the message queue and marks it deactivated.

See also:
flush().
Return values:
The number of messages released from the queue; -1 on error.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::deactivated ( void   )  [virtual]

Returns true if the state of the queue is DEACTIVATED, but false if the queue's state is ACTIVATED or PULSED.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::dequeue ( ACE_MESSAGE_TYPE *&  first_item,
ACE_Time_Value timeout = 0 
) [virtual]

This method is an alias for the following <dequeue_head> method.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::dequeue_deadline ( ACE_MESSAGE_TYPE *&  dequeued,
ACE_Time_Value timeout = 0 
) [virtual]

Because there's deadline associated with enqueue_deadline(), this method will behave just as dequeue_head().

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::dequeue_head ( ACE_MESSAGE_TYPE *&  first_item,
ACE_Time_Value timeout = 0 
) [virtual]

Dequeue the item at the head of the queue and return a pointer to it.

Parameters:
first_item Reference to an ACE_MESSAGE_TYPE * that will be set to the address of the dequeued item.
timeout The absolute time the caller will wait until for an item to be dequeued.
Return values:
>=0 The number of items remaining in the queue.
-1 On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::dequeue_prio ( ACE_MESSAGE_TYPE *&  dequeued,
ACE_Time_Value timeout = 0 
) [virtual]

Dequeue the item that has the lowest priority (preserves FIFO order for items with the same priority) and return a pointer to it.

Parameters:
dequeued Reference to an ACE_MESSAGE_TYPE * that will be set to the address of the dequeued item.
timeout The absolute time the caller will wait until for an item to be dequeued.
Return values:
>=0 The number of items remaining in the queue.
-1 On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::dequeue_tail ( ACE_MESSAGE_TYPE *&  dequeued,
ACE_Time_Value timeout = 0 
) [virtual]

Dequeue the item at the tail of the queue and return a pointer to it.

Parameters:
dequeued Reference to an ACE_MESSAGE_TYPE * that will be set to the address of the dequeued item.
timeout The absolute time the caller will wait until for an item to be dequeued.
Return values:
>=0 The number of items remaining in the queue.
-1 On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual void ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::dump ( void   )  const [virtual]

Dump the state of an object.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::enqueue ( ACE_MESSAGE_TYPE *  new_item,
ACE_Time_Value timeout = 0 
) [virtual]

Deprecated:
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.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::enqueue_deadline ( ACE_MESSAGE_TYPE *  new_item,
ACE_Time_Value timeout = 0 
) [virtual]

This method acts just like enqueue_tail(). There's no deadline time associated with items.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::enqueue_head ( ACE_MESSAGE_TYPE *  new_item,
ACE_Time_Value timeout = 0 
) [virtual]

Enqueue an item at the head of the queue.

Parameters:
new_item Pointer to an item that will be added to the queue.
timeout The absolute time the caller will wait until for the item to be queued.
Return values:
>0 The number of items on the queue after adding the specified item.
-1 On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

Reimplemented in ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::enqueue_prio ( ACE_MESSAGE_TYPE *  new_item,
ACE_Time_Value timeout = 0,
unsigned long  priority = DEFAULT_PRIORITY 
) [virtual]

Enqueue an ACE_MESSAGE TYPE into the queue in accordance with the specified priority (0 is lowest priority). FIFO order is maintained when items of the same priority are inserted consecutively.

Parameters:
new_item Pointer to an item that will be added to the queue.
timeout The absolute time the caller will wait until for the block to be queued.
priority The priority to use when enqueueing the item.
Return values:
>0 The number of items on the queue after adding the specified item.
-1 On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::enqueue_tail ( ACE_MESSAGE_TYPE *  new_item,
ACE_Time_Value timeout = 0 
) [virtual]

Enqueue an item at the tail of the queue.

Parameters:
new_item Pointer to an item that will be added to the queue.
timeout The absolute time the caller will wait until for the item to be queued.
Return values:
>0 The number of items on the queue after adding the specified item.
-1 On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

Reimplemented in ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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.

See also:
close().
Returns:
The number of messages flushed; -1 on error.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::flush_i ( void   )  [virtual]

Release all resources from the message queue but do not mark it as deactivated.

Precondition:
The caller must be holding the queue lock before calling this method.
Returns:
The number of messages flushed.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual void ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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."

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual size_t ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::high_water_mark ( void   )  [virtual]

Get high watermark.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual bool ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::is_empty ( void   )  [virtual]

True if queue is empty, else false.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual bool ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::is_full ( void   )  [virtual]

True if queue is full, else false.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual ACE_SYNCH_MUTEX_T& ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::lock ( void   )  [virtual]

Returns a reference to the lock used by the ACE_Message_Queue_Ex.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual void ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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_TYPE>s.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual size_t ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::low_water_mark ( void   )  [virtual]

Get low watermark.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual void ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual size_t ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::message_bytes ( void   )  [virtual]

Number of total bytes on the queue, i.e., sum of the message block sizes.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual size_t ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::message_count ( void   )  [virtual]

Number of total messages on the queue.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual void ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual size_t ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::message_length ( void   )  [virtual]

Number of total length on the queue, i.e., sum of the message block lengths.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual void ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::notification_strategy ( ACE_Notification_Strategy s  )  [virtual]

Set the notification strategy for the <Message_Queue>.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual ACE_Notification_Strategy* ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::notification_strategy ( void   )  [virtual]

Get the notification strategy for the <Message_Queue>.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::open ( size_t  hwm = ACE_Message_Queue_Base::DEFAULT_HWM,
size_t  lwm = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy = 0 
) [virtual]

Initialize an ACE_Message_Queue_Ex.

Parameters:
high_water_mark 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.
low_water_mark 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.
See also:
ACE_Reactor_Notification_Strategy.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::peek_dequeue_head ( ACE_MESSAGE_TYPE *&  first_item,
ACE_Time_Value timeout = 0 
) [virtual]

Retrieve a pointer to the first item in the queue without removing it.

Note:
Because the item whose pointer is returned is still on the queue, another thread may dequeue that item at any time, including before the calling thread examines the peeked-at item. Be very careful with this method in multithreaded queueing situations.
Parameters:
first_item Reference to an ACE_MESSAGE_TYPE * that will point to the first item on the queue. The item remains on the queue until this or another thread dequeues it.
timeout The absolute time the caller will wait until for an item to be queued.
Return values:
>0 The number of items on the queue.
-1 On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::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.

Return values:
The queue's state before this call.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
virtual int ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::state ( void   )  [virtual]

Returns the current state of the queue, which can be one of ACTIVATED, DEACTIVATED, or PULSED.


Friends And Related Function Documentation

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
friend class ACE_Message_Queue_Ex_Iterator< ACE_MESSAGE_TYPE, ACE_SYNCH_USE > [friend]

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
friend class ACE_Message_Queue_Ex_Reverse_Iterator< ACE_MESSAGE_TYPE, ACE_SYNCH_USE > [friend]


Member Data Documentation

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Reimplemented in ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >.

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >
ACE_Message_Queue<ACE_SYNCH_USE> ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL >::queue_ [protected]

Implement this via an ACE_Message_Queue.


The documentation for this class was generated from the following file:

Generated on Mon Jul 13 16:12:13 2009 for ACE by  doxygen 1.5.8