diff options
Diffstat (limited to 'TAO/tao/Servant_Base.cpp')
-rw-r--r-- | TAO/tao/Servant_Base.cpp | 92 |
1 files changed, 34 insertions, 58 deletions
diff --git a/TAO/tao/Servant_Base.cpp b/TAO/tao/Servant_Base.cpp index 8c6633a173f..bd551c0636c 100644 --- a/TAO/tao/Servant_Base.cpp +++ b/TAO/tao/Servant_Base.cpp @@ -18,16 +18,16 @@ ACE_RCSID(tao, Servant_Base, "$Id$") #if defined (ACE_ENABLE_TIMEPROBES) static const char *TAO_Servant_Base_Timeprobe_Description[] = -{ - "Servant_Base::_find - start", - "Servant_Base::_find - end" -}; + { + "Servant_Base::_find - start", + "Servant_Base::_find - end" + }; enum -{ - TAO_SERVANT_BASE_FIND_START = 700, - TAO_SERVANT_BASE_FIND_END -}; + { + TAO_SERVANT_BASE_FIND_START = 700, + TAO_SERVANT_BASE_FIND_END + }; // Setup Timeprobes ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Servant_Base_Timeprobe_Description, @@ -36,16 +36,12 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Servant_Base_Timeprobe_Description, #endif /* ACE_ENABLE_TIMEPROBES */ TAO_ServantBase::TAO_ServantBase (void) - : optable_ (0), - single_threaded_poa_lock_ (0), - single_threaded_poa_lock_count_ (0) + : optable_ (0) { } TAO_ServantBase::TAO_ServantBase (const TAO_ServantBase &rhs) - : optable_ (rhs.optable_), - single_threaded_poa_lock_ (0), - single_threaded_poa_lock_count_ (0) + : optable_ (rhs.optable_) { } @@ -115,13 +111,13 @@ TAO_ServantBase::_create_stub (CORBA_Environment &env) TAO_Stub *stub; TAO_ORB_Core *orb_core = TAO_ORB_Core_instance (); - TAO_POA_Current &poa_current = orb_core->poa_current (); - TAO_POA_Current_Impl *poa_current_impl = poa_current.implementation (); + TAO_POA_Current *poa_current = orb_core->poa_current (); - if (poa_current_impl != 0 && - this == poa_current_impl->servant ()) + if (poa_current != 0 + && poa_current->in_upcall () + && this == poa_current->servant ()) { - stub = orb_core->orb ()->create_stub_object (poa_current_impl->object_key (), + stub = orb_core->orb ()->create_stub_object (poa_current->object_key (), this->_interface_repository_id (), env); } @@ -146,38 +142,6 @@ TAO_ServantBase::_create_stub (CORBA_Environment &env) return stub; } -ACE_SYNCH_MUTEX & -TAO_ServantBase::_single_threaded_poa_lock (void) -{ - return *this->single_threaded_poa_lock_; -} - -void -TAO_ServantBase::_increment_single_threaded_poa_lock_count (void) -{ - // Only one thread at a time through this code (guarantee provided - // by the POA). - u_long current_count = this->single_threaded_poa_lock_count_++; - if (current_count == 0) - { - ACE_NEW (this->single_threaded_poa_lock_, - ACE_SYNCH_MUTEX); - } -} - -void -TAO_ServantBase::_decrement_single_threaded_poa_lock_count (void) -{ - // Only one thread at a time through this code (guarantee provided - // by the POA). - u_long current_count = --this->single_threaded_poa_lock_count_; - if (current_count == 0) - { - delete this->single_threaded_poa_lock_; - this->single_threaded_poa_lock_ = 0; - } -} - TAO_RefCountServantBase::~TAO_RefCountServantBase (void) { } @@ -357,28 +321,28 @@ TAO_DynamicImplementation::_create_stub (CORBA::Environment &env) // by the DSI servant, it raises the PortableServer::WrongPolicy // exception. TAO_ORB_Core *orb_core = TAO_ORB_Core_instance (); - TAO_POA_Current &poa_current = orb_core->poa_current (); - TAO_POA_Current_Impl *poa_current_impl = poa_current.implementation (); + TAO_POA_Current *poa_current = orb_core->poa_current (); - if (poa_current_impl == 0 && - this != poa_current_impl->servant ()) + if (poa_current == 0 + || !poa_current->in_upcall () + || this != poa_current->servant ()) { CORBA::Exception *exception = new PortableServer::POA::WrongPolicy; env.exception (exception); return 0; } - PortableServer::POA_var poa = poa_current_impl->get_POA (env); + PortableServer::POA_var poa = poa_current->get_POA (env); if (env.exception () != 0) return 0; - CORBA::RepositoryId interface = this->_primary_interface (poa_current_impl->object_id (), + CORBA::RepositoryId interface = this->_primary_interface (poa_current->object_id (), poa.in (), env); if (env.exception () != 0) return 0; - return TAO_ORB_Core_instance ()->orb ()->create_stub_object (poa_current_impl->object_key (), + return TAO_ORB_Core_instance ()->orb ()->create_stub_object (poa_current->object_key (), interface, env); } @@ -401,3 +365,15 @@ TAO_DynamicImplementation::_dispatch (CORBA::ServerRequest &request, } #endif /* TAO_HAS_MINIMUM_CORBA */ + +//////////////////////////////////////////////////////////////////////////////// + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Atomic_Op<ACE_SYNCH_MUTEX, CORBA::ULong>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Atomic_Op<ACE_SYNCH_MUTEX, CORBA::ULong> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ |