TAO_CEC_Dispatching_Task Class Reference

Implement the dispatching queues for FIFO and Priority dispatching. More...

#include <CEC_Dispatching_Task.h>

Inheritance diagram for TAO_CEC_Dispatching_Task:

Inheritance graph
[legend]
Collaboration diagram for TAO_CEC_Dispatching_Task:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_CEC_Dispatching_Task (ACE_Thread_Manager *thr_manager=0)
 Constructor.
virtual int svc (void)
 Process the events in the queue.
virtual void push (TAO_CEC_ProxyPushSupplier *proxy, CORBA::Any &event)

Private Attributes

ACE_Allocatorallocator_
 An per-task allocator.
ACE_Locked_Data_Block< ACE_Lock_Adapter<
TAO_SYNCH_MUTEX > > 
data_block_
 Helper data structure to minimize memory allocations...

Detailed Description

Implement the dispatching queues for FIFO and Priority dispatching.

Definition at line 47 of file CEC_Dispatching_Task.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_CEC_Dispatching_Task::TAO_CEC_Dispatching_Task ( ACE_Thread_Manager thr_manager = 0  ) 

Constructor.

Definition at line 9 of file CEC_Dispatching_Task.inl.

00010   :  ACE_Task<ACE_SYNCH> (thr_manager),
00011      allocator_ (0)
00012 {
00013 }


Member Function Documentation

void TAO_CEC_Dispatching_Task::push ( TAO_CEC_ProxyPushSupplier proxy,
CORBA::Any &  event 
) [virtual]

Definition at line 62 of file CEC_Dispatching_Task.cpp.

References allocator_, CORBA::COMPLETED_NO, ACE_Allocator::instance(), ACE_Allocator::malloc(), ACE_Task< ACE_SYNCH >::putq(), and TAO::VMCID.

Referenced by TAO_CEC_MT_Dispatching::push_nocopy().

00064 {
00065   if (this->allocator_ == 0)
00066     this->allocator_ = ACE_Allocator::instance ();
00067 
00068   void* buf = this->allocator_->malloc (sizeof (TAO_CEC_Push_Command));
00069 
00070   if (buf == 0)
00071     throw CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO);
00072 
00073   ACE_Message_Block *mb =
00074     new (buf) TAO_CEC_Push_Command (proxy,
00075                                     event,
00076                                     this->data_block_.duplicate (),
00077                                     this->allocator_);
00078   this->putq (mb);
00079 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL int TAO_CEC_Dispatching_Task::svc ( void   )  [virtual]

Process the events in the queue.

Reimplemented from ACE_Task_Base.

Definition at line 22 of file CEC_Dispatching_Task.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_ERROR, TAO_CEC_Dispatch_Command::execute(), ACE_OS::last_error(), LM_ERROR, and ACE_Message_Block::release().

00023 {
00024   int done = 0;
00025   while (!done)
00026     {
00027       try
00028         {
00029           ACE_Message_Block *mb;
00030           if (this->getq (mb) == -1)
00031             if (ACE_OS::last_error () == ESHUTDOWN)
00032               return 0;
00033           else
00034             ACE_ERROR ((LM_ERROR,
00035                         "EC (%P|%t) getq error in Dispatching Queue\n"));
00036 
00037           TAO_CEC_Dispatch_Command *command =
00038             dynamic_cast<TAO_CEC_Dispatch_Command*> (mb);
00039 
00040           if (command == 0)
00041             {
00042               ACE_Message_Block::release (mb);
00043               continue;
00044             }
00045 
00046           int result = command->execute ();
00047 
00048           ACE_Message_Block::release (mb);
00049 
00050           if (result == -1)
00051             done = 1;
00052         }
00053       catch (const CORBA::Exception& ex)
00054         {
00055           ex._tao_print_exception ("EC (%P|%t) exception in dispatching queue");
00056         }
00057     }
00058   return 0;
00059 }


Member Data Documentation

ACE_Allocator* TAO_CEC_Dispatching_Task::allocator_ [private]

An per-task allocator.

Definition at line 66 of file CEC_Dispatching_Task.h.

Referenced by push().

ACE_Locked_Data_Block<ACE_Lock_Adapter<TAO_SYNCH_MUTEX> > TAO_CEC_Dispatching_Task::data_block_ [private]

Helper data structure to minimize memory allocations...

Definition at line 69 of file CEC_Dispatching_Task.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:44:58 2010 for TAO_CosEvent by  doxygen 1.4.7