RefCountServantBase.cpp

00001 
00005 
00006 #include "RefCountServantBase.h"
00007 
00008 Sct::RefCountServantBase::~RefCountServantBase() {}
00009 
00010 
00011 void Sct::RefCountServantBase::_sct_add_ref()
00012 {
00013   boost::mutex::scoped_lock lk(this->m_mutex);
00014   // If the reference count is 0, then the object is either in the
00015   // process of being deleted by _remove_ref, or has already been
00016   // deleted. It is too late to be trying to _add_ref now. If the
00017   // reference count is less than zero, then _remove_ref has been
00018   // called too many times.
00019   //OMNIORB_USER_CHECK(pd_refCount > 0);
00020 
00021   pd_refCount++;
00022 }
00023 
00024 
00025 void Sct::RefCountServantBase::_sct_remove_ref() {
00026   
00027   int done;
00028   {
00029     boost::mutex::scoped_lock lk(this->m_mutex);
00030     done = --pd_refCount > 0;
00031   };
00032   
00033   if( done )  return;
00034   
00035   if( pd_refCount < 0 ) {
00036     //omniORB::logs(1, "RefCountServantBase has negative ref count!");
00037     return;
00038   }
00039 
00040   //omniORB::logs(15, "RefCountServantBase has zero ref count -- deleted.");
00041 
00042   // The PortableServer::RefCountServantBase calls delete this, but we want to be more flexible, so:
00043   this->performCountEqualsZeroAction();
00044 }
00045 

Generated on Mon Feb 6 14:01:25 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6