00001 // -*- C++ - 00002 // 00003 // $Id: CSD_TP_Custom_Request.inl 69182 2005-11-03 17:38:46Z ossama $ 00004 00005 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 ACE_INLINE 00008 TAO::CSD::TP_Custom_Request::TP_Custom_Request 00009 (TP_Custom_Request_Operation* op, 00010 TP_Servant_State* servant_state) 00011 : TP_Request(op->servant(),servant_state), 00012 op_(op, false) 00013 { 00014 } 00015 00016 00017 ACE_INLINE 00018 void 00019 TAO::CSD::TP_Custom_Request::execute_op() 00020 { 00021 this->op_->execute(); 00022 00023 // Now drop the reference to the custom operation object. 00024 // This is necessary so that custom operation objects can be created 00025 // on the stack for synchronous custom requests. If we do not do this, 00026 // then there is a race condition which could result in the stack-created 00027 // custom operation object having a reference count of 2 when it falls 00028 // out of scope (and destructs). Our op_ data member would be the one 00029 // that held the other reference, and when our op_ data member destructs, 00030 // it attempts to perform a _remove_ref() on the underlying operation 00031 // object - which has already been destructed! Thus, we reset the op_ 00032 // data member here to the 'nil' state - causing the _remove_ref() to 00033 // be performed now. 00034 this->op_ = 0; 00035 } 00036 00037 00038 ACE_INLINE 00039 void 00040 TAO::CSD::TP_Custom_Request::cancel_op() 00041 { 00042 this->op_->cancel(); 00043 00044 // See comments in the execute_op() method. 00045 this->op_ = 0; 00046 } 00047 00048 TAO_END_VERSIONED_NAMESPACE_DECL