This class helps us with a recursive thread lock without using a recursive thread lock. Non_Servant_Upcall has a magic constructor and destructor. We unlock the Object_Adapter lock for the duration of the non-servant (i.e., adapter activator and servant activator) upcalls; reacquiring once the upcalls complete. Even though we are releasing the lock, other threads will not be able to make progress since <Object_Adapter::non_servant_upcall_in_progress_> has been set. More...
#include <Non_Servant_Upcall.h>
Public Member Functions | |
Non_Servant_Upcall (::TAO_Root_POA &poa) | |
Constructor. | |
~Non_Servant_Upcall (void) | |
Destructor. | |
::TAO_Root_POA & | poa (void) const |
Protected Attributes | |
TAO_Object_Adapter & | object_adapter_ |
TAO_Root_POA & | poa_ |
Non_Servant_Upcall * | previous_ |
This class helps us with a recursive thread lock without using a recursive thread lock. Non_Servant_Upcall has a magic constructor and destructor. We unlock the Object_Adapter lock for the duration of the non-servant (i.e., adapter activator and servant activator) upcalls; reacquiring once the upcalls complete. Even though we are releasing the lock, other threads will not be able to make progress since <Object_Adapter::non_servant_upcall_in_progress_> has been set.
Definition at line 50 of file Non_Servant_Upcall.h.
TAO::Portable_Server::Non_Servant_Upcall::Non_Servant_Upcall | ( | ::TAO_Root_POA & | poa | ) |
Constructor.
Definition at line 21 of file Non_Servant_Upcall.cpp.
: object_adapter_ (poa.object_adapter ()), poa_ (poa), previous_ (0) { // Check if this is a nested non_servant_upcall. if (this->object_adapter_.non_servant_upcall_nesting_level_ != 0) { // Remember previous instance of non_servant_upcall. this->previous_ = this->object_adapter_.non_servant_upcall_in_progress_; // Assert that the thread is the same as the one before. ACE_ASSERT (ACE_OS::thr_equal ( this->object_adapter_.non_servant_upcall_thread_, ACE_OS::thr_self ())); } // Remember which thread is calling the adapter activators. this->object_adapter_.non_servant_upcall_thread_ = ACE_OS::thr_self (); // Mark the fact that a non-servant upcall is in progress. this->object_adapter_.non_servant_upcall_in_progress_ = this; // Adjust the nesting level. this->object_adapter_.non_servant_upcall_nesting_level_++; // We always release this->object_adapter_.lock ().release (); }
TAO::Portable_Server::Non_Servant_Upcall::~Non_Servant_Upcall | ( | void | ) |
Destructor.
Definition at line 52 of file Non_Servant_Upcall.cpp.
{ // Reacquire the Object Adapter lock. this->object_adapter_.lock ().acquire (); // Adjust the nesting level. this->object_adapter_.non_servant_upcall_nesting_level_--; // We are done with this nested upcall. this->object_adapter_.non_servant_upcall_in_progress_ = this->previous_; // If we are at the outer nested upcall. if (this->object_adapter_.non_servant_upcall_nesting_level_ == 0) { // Reset thread id. this->object_adapter_.non_servant_upcall_thread_ = ACE_OS::NULL_thread; // Check if all pending requests are over. if (this->poa_.waiting_destruction () && this->poa_.outstanding_requests () == 0) { try { this->poa_.complete_destruction_i (); } catch (const::CORBA::Exception&ex) { // Ignore exceptions ex._tao_print_exception ("TAO_POA::complete_destruction_i"); } } // If locking is enabled. if (this->object_adapter_.enable_locking_) // Wakeup all waiting threads. this->object_adapter_.non_servant_upcall_condition_.broadcast (); } }
TAO_Root_POA & TAO::Portable_Server::Non_Servant_Upcall::poa | ( | void | ) | const |
Definition at line 12 of file Non_Servant_Upcall.inl.
{ return this->poa_; }
TAO_Object_Adapter& TAO::Portable_Server::Non_Servant_Upcall::object_adapter_ [protected] |
Definition at line 64 of file Non_Servant_Upcall.h.
TAO_Root_POA& TAO::Portable_Server::Non_Servant_Upcall::poa_ [protected] |
Definition at line 65 of file Non_Servant_Upcall.h.
Non_Servant_Upcall* TAO::Portable_Server::Non_Servant_Upcall::previous_ [protected] |
Definition at line 66 of file Non_Servant_Upcall.h.