Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / CSD_ThreadPool / CSD_TP_Custom_Request.inl
blob0f10b55aca8492f677b2c98cd200662de6e0dde9
1 // -*- C++ -
2 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
4 ACE_INLINE
5 TAO::CSD::TP_Custom_Request::TP_Custom_Request
6                                  (TP_Custom_Request_Operation* op,
7                                   TP_Servant_State*            servant_state)
8   : TP_Request(op->servant(),servant_state),
9     op_(op, false)
14 ACE_INLINE
15 void
16 TAO::CSD::TP_Custom_Request::execute_op()
18   this->op_->execute();
20   // Now drop the reference to the custom operation object.
21   // This is necessary so that custom operation objects can be created
22   // on the stack for synchronous custom requests.  If we do not do this,
23   // then there is a race condition which could result in the stack-created
24   // custom operation object having a reference count of 2 when it falls
25   // out of scope (and destructs).  Our op_ data member would be the one
26   // that held the other reference, and when our op_ data member destructs,
27   // it attempts to perform a _remove_ref() on the underlying operation
28   // object - which has already been destructed!  Thus, we reset the op_
29   // data member here to the 'nil' state - causing the _remove_ref() to
30   // be performed now.
31   this->op_ = 0;
35 ACE_INLINE
36 void
37 TAO::CSD::TP_Custom_Request::cancel_op()
39   this->op_->cancel();
41   // See comments in the execute_op() method.
42   this->op_ = 0;
45 TAO_END_VERSIONED_NAMESPACE_DECL