ACE 6.0.5
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
ACE_Message_Queue_NT Class Reference

Message Queue implementation using IO completion port on NT. More...

#include <Message_Queue_NT.h>

Inheritance diagram for ACE_Message_Queue_NT:
Inheritance graph
[legend]
Collaboration diagram for ACE_Message_Queue_NT:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_Message_Queue_NT (DWORD max_threads=ACE_Message_Queue_Base::DEFAULT_HWM)
virtual int open (DWORD max_threads=ACE_Message_Queue_Base::DEFAULT_HWM)
virtual int close (void)
virtual ~ACE_Message_Queue_NT (void)
 Close down the message queue and release all resources.
virtual int enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0)
virtual int enqueue (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0)
virtual int dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)
virtual int dequeue (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)
virtual bool is_full (void)
virtual bool is_empty (void)
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)
virtual DWORD max_threads (void)
 Get the max concurrent thread number.
virtual int deactivate (void)
virtual int activate (void)
virtual int pulse (void)
virtual int deactivated (void)
int peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)
ACE_Notification_Strategynotification_strategy (void)
 Get the notification strategy for the <Message_Queue>
void notification_strategy (ACE_Notification_Strategy *s)
 Set the notification strategy for the <Message_Queue>
virtual void dump (void) const
 Dump the state of an object.
virtual ACE_HANDLE completion_port (void)
 Get the handle to the underlying completion port.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Private Member Functions

 ACE_Message_Queue_NT (const ACE_Message_Queue_NT &)
void operator= (const ACE_Message_Queue_NT &)

Private Attributes

DWORD max_cthrs_
 Maximum threads that can be released (and run) concurrently.
DWORD cur_thrs_
 Current number of threads waiting to dequeue messages.
size_t cur_bytes_
 Current number of bytes in queue.
size_t cur_length_
 Current length of messages in queue.
size_t cur_count_
 Current number of messages in the queue.
ACE_SYNCH_MUTEX lock_
ACE_HANDLE completion_port_
 Underlying NT IoCompletionPort.

Detailed Description

Message Queue implementation using IO completion port on NT.

Implementation of a strip-downed ACE_Message_Queue using NT's IO completion port mechanism.

Note:
*Many* ACE_Message_Queue features are not supported with this implementation, including: * <open> method have different signatures. * <dequeue_head> *requires* that the ACE_Message_Block pointer argument point to an ACE_Message_Block that was allocated by the caller. * <peek_dequeue_head>. * <ACE_Message_Queue_Iterators>. * No flow control.

Constructor & Destructor Documentation

ACE_Message_Queue_NT::ACE_Message_Queue_NT ( DWORD  max_threads = ACE_Message_Queue_Base::DEFAULT_HWM)
ACE_Message_Queue_NT::~ACE_Message_Queue_NT ( void  ) [virtual]

Close down the message queue and release all resources.

ACE_Message_Queue_NT::ACE_Message_Queue_NT ( const ACE_Message_Queue_NT ) [private]

Member Function Documentation

int ACE_Message_Queue_NT::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.

int ACE_Message_Queue_NT::close ( void  ) [virtual]

Close down the underlying I/O completion port. You need to re-open the MQ after this function is executed.

Implements ACE_Message_Queue_Base.

ACE_HANDLE ACE_Message_Queue_NT::completion_port ( void  ) [inline, virtual]

Get the handle to the underlying completion port.

int ACE_Message_Queue_NT::deactivate ( void  ) [virtual]

Deactivate the queue and wake up 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.

Return values:
Thequeue's state before this call.

Implements ACE_Message_Queue_Base.

int ACE_Message_Queue_NT::deactivated ( void  ) [inline, 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.

int ACE_Message_Queue_NT::dequeue ( ACE_Message_Block *&  first_item,
ACE_Time_Value timeout = 0 
) [virtual]
int ACE_Message_Queue_NT::dequeue_head ( ACE_Message_Block *&  first_item,
ACE_Time_Value timeout = 0 
) [inline, virtual]

Dequeue and return the ACE_Message_Block * at the head of the queue. Returns -1 on failure, else the number of items still on the queue.

Implements ACE_Message_Queue_Base.

void ACE_Message_Queue_NT::dump ( void  ) const [virtual]

Dump the state of an object.

Implements ACE_Message_Queue_Base.

int ACE_Message_Queue_NT::enqueue ( ACE_Message_Block new_item,
ACE_Time_Value timeout = 0 
) [virtual]
int ACE_Message_Queue_NT::enqueue_tail ( ACE_Message_Block new_item,
ACE_Time_Value timeout = 0 
) [inline, virtual]

Enqueue an ACE_Message_Block * at the end of the queue. Returns -1 on failure, else the number of items still on the queue.

Implements ACE_Message_Queue_Base.

bool ACE_Message_Queue_NT::is_empty ( void  ) [inline, virtual]

True if queue is empty, else false. Notice the return value is only transient.

Implements ACE_Message_Queue_Base.

bool ACE_Message_Queue_NT::is_full ( void  ) [inline, virtual]

Always return false.

Implements ACE_Message_Queue_Base.

DWORD ACE_Message_Queue_NT::max_threads ( void  ) [inline, virtual]

Get the max concurrent thread number.

size_t ACE_Message_Queue_NT::message_bytes ( void  ) [inline, virtual]

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

Implements ACE_Message_Queue_Base.

void ACE_Message_Queue_NT::message_bytes ( size_t  new_size) [inline, 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.

size_t ACE_Message_Queue_NT::message_count ( void  ) [inline, virtual]

Number of total messages on the queue.

Implements ACE_Message_Queue_Base.

size_t ACE_Message_Queue_NT::message_length ( void  ) [inline, virtual]

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

Implements ACE_Message_Queue_Base.

void ACE_Message_Queue_NT::message_length ( size_t  new_length) [inline, 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.

ACE_Notification_Strategy * ACE_Message_Queue_NT::notification_strategy ( void  ) [inline, virtual]

Get the notification strategy for the <Message_Queue>

Implements ACE_Message_Queue_Base.

void ACE_Message_Queue_NT::notification_strategy ( ACE_Notification_Strategy s) [inline, virtual]

Set the notification strategy for the <Message_Queue>

Implements ACE_Message_Queue_Base.

int ACE_Message_Queue_NT::open ( DWORD  max_threads = ACE_Message_Queue_Base::DEFAULT_HWM) [virtual]

Initialize the Message Queue by creating a new NT I/O completion port. The first arguemnt specifies the number of threads released by the MQ that are allowed to run concurrently. Return 0 when succeeds, -1 otherwise.

void ACE_Message_Queue_NT::operator= ( const ACE_Message_Queue_NT ) [private]
int ACE_Message_Queue_NT::peek_dequeue_head ( ACE_Message_Block *&  first_item,
ACE_Time_Value timeout = 0 
) [inline, virtual]

Retrieve the first ACE_Message_Block 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.

Implements ACE_Message_Queue_Base.

int ACE_Message_Queue_NT::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:
Thequeue's state before this call.

Implements ACE_Message_Queue_Base.


Member Data Documentation

Declare the dynamic allocation hooks.

Reimplemented from ACE_Message_Queue_Base.

Underlying NT IoCompletionPort.

Current number of bytes in queue.

Current number of messages in the queue.

Current length of messages in queue.

Current number of threads waiting to dequeue messages.

ACE_SYNCH_MUTEX ACE_Message_Queue_NT::lock_ [private]

Synchronizer. This should really be an ACE_Recursive_Thread_Mutex but since this class is only supported on NT, it's okay to use ACE_Thread_Mutex here.

Maximum threads that can be released (and run) concurrently.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines