ACE  6.4.2
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
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]

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. More...
 
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. More...
 
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. More...
 
void notification_strategy (ACE_Notification_Strategy *s)
 Set the notification strategy for the Message_Queue. More...
 
virtual void dump (void) const
 Dump the state of an object. More...
 
virtual ACE_HANDLE completion_port (void)
 Get the handle to the underlying completion port. More...
 
- Public Member Functions inherited from ACE_Message_Queue_Base
 ACE_Message_Queue_Base (void)
 
virtual ~ACE_Message_Queue_Base (void)
 Close down the message queue and release all resources. More...
 
virtual int state (void)
 Returns the current state of the queue. More...
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...
 

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. More...
 
DWORD cur_thrs_
 Current number of threads waiting to dequeue messages. More...
 
size_t cur_bytes_
 Current number of bytes in queue. More...
 
size_t cur_length_
 Current length of messages in queue. More...
 
size_t cur_count_
 Current number of messages in the queue. More...
 
ACE_SYNCH_MUTEX lock_
 
ACE_HANDLE completion_port_
 Underlying NT IoCompletionPort. More...
 

Additional Inherited Members

- Public Types inherited from ACE_Message_Queue_Base
enum  {
  DEFAULT_HWM = 16 * 1024, DEFAULT_LWM = 16 * 1024, ACTIVATED = 1, DEACTIVATED = 2,
  PULSED = 3
}
 
- Protected Attributes inherited from ACE_Message_Queue_Base
int state_
 

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  )
inlinevirtual

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  )
inlinevirtual

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 
)
inlinevirtual

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 
)
inlinevirtual

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  )
inlinevirtual

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  )
inlinevirtual

Always return false.

Implements ACE_Message_Queue_Base.

DWORD ACE_Message_Queue_NT::max_threads ( void  )
inlinevirtual

Get the max concurrent thread number.

size_t ACE_Message_Queue_NT::message_bytes ( void  )
inlinevirtual

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)
inlinevirtual

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  )
inlinevirtual

Number of total messages on the queue.

Implements ACE_Message_Queue_Base.

size_t ACE_Message_Queue_NT::message_length ( void  )
inlinevirtual

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)
inlinevirtual

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  )
inlinevirtual

Get the notification strategy for the Message_Queue.

Implements ACE_Message_Queue_Base.

void ACE_Message_Queue_NT::notification_strategy ( ACE_Notification_Strategy s)
inlinevirtual

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 
)
inlinevirtual

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

ACE_Message_Queue_NT::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

ACE_HANDLE ACE_Message_Queue_NT::completion_port_
private

Underlying NT IoCompletionPort.

size_t ACE_Message_Queue_NT::cur_bytes_
private

Current number of bytes in queue.

size_t ACE_Message_Queue_NT::cur_count_
private

Current number of messages in the queue.

size_t ACE_Message_Queue_NT::cur_length_
private

Current length of messages in queue.

DWORD ACE_Message_Queue_NT::cur_thrs_
private

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.

DWORD ACE_Message_Queue_NT::max_cthrs_
private

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


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