00001 // $Id: ESF_Proxy_RefCount_Guard.cpp 73791 2006-07-27 20:54:56Z wotte $ 00002 00003 #ifndef TAO_ESF_PROXY_REFCOUNT_GUARD_CPP 00004 #define TAO_ESF_PROXY_REFCOUNT_GUARD_CPP 00005 00006 #include "orbsvcs/ESF/ESF_Proxy_RefCount_Guard.h" 00007 00008 #if ! defined (__ACE_INLINE__) 00009 #include "orbsvcs/ESF/ESF_Proxy_RefCount_Guard.inl" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 template<class EC, class P> 00015 TAO_ESF_Proxy_RefCount_Guard<EC,P>::~TAO_ESF_Proxy_RefCount_Guard (void) 00016 { 00017 // Checking for 0 is safe, once the variable reaches 0 the value 00018 // will stay there. 00019 // @@ But what if the thread is switched to another processor just 00020 // after release the mutex? 00021 if (this->refcount_ == 0) 00022 { 00023 this->event_channel_->destroy_proxy (this->proxy_); 00024 } 00025 } 00026 00027 TAO_END_VERSIONED_NAMESPACE_DECL 00028 00029 #endif /* TAO_ESF_PROXY_REFCOUNT_GUARD_CPP */