diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2011-03-02 19:28:50 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2011-03-02 19:28:50 +0000 |
commit | 8f26211723e947f1f8bf263dfc02e1a268a9d30f (patch) | |
tree | bded18b0789fcf7373ef89aa87549405a1fff351 /TAO/tao | |
parent | 5f252c5cadf7e055d1e842035990338157089097 (diff) | |
download | ATCD-8f26211723e947f1f8bf263dfc02e1a268a9d30f.tar.gz |
Wed Mar 2 19:22:23 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl>
* orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h:
* orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp:
* tao/Stub.h:
* tao/Stub.inl:
* tao/Stub.cpp:
Applied changes reverted on Mon Feb 14, didn't break the ImR example
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/Stub.cpp | 33 | ||||
-rw-r--r-- | TAO/tao/Stub.h | 13 | ||||
-rw-r--r-- | TAO/tao/Stub.inl | 44 |
3 files changed, 41 insertions, 49 deletions
diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp index a983f392794..79fb25b12ec 100644 --- a/TAO/tao/Stub.cpp +++ b/TAO/tao/Stub.cpp @@ -43,7 +43,6 @@ TAO_Stub::TAO_Stub (const char *repository_id, , forward_profiles_ (0) , forward_profiles_perm_ (0) , profile_in_use_ (0) - , profile_lock_ptr_ (0) , profile_success_ (false) , refcount_ (1) #if (TAO_HAS_CORBA_MESSAGING == 1) @@ -74,9 +73,6 @@ TAO_Stub::TAO_Stub (const char *repository_id, // Cache the ORB pointer to respond faster to certain queries. this->orb_ = CORBA::ORB::_duplicate (this->orb_core_->orb ()); - this->profile_lock_ptr_ = - this->orb_core_->client_factory ()->create_profile_lock (); - this->base_profiles (profiles); } @@ -97,8 +93,6 @@ TAO_Stub::~TAO_Stub (void) this->profile_in_use_ = 0; } - delete this->profile_lock_ptr_; - #if (TAO_HAS_CORBA_MESSAGING == 1) delete this->policies_; #endif @@ -114,9 +108,9 @@ TAO_Stub::add_forward_profiles (const TAO_MProfile &mprofiles, { // we assume that the profile_in_use_ is being // forwarded! Grab the lock so things don't change. - ACE_MT (ACE_GUARD (ACE_Lock, + ACE_MT (ACE_GUARD (TAO_SYNCH_MUTEX, guard, - *this->profile_lock_ptr_)); + this->profile_lock_)); if (permanent_forward) { @@ -156,9 +150,9 @@ TAO_Stub::create_ior_info (IOP::IOR *&ior_info, CORBA::ULong &index) { // We are creating the IOR info. Let us not be disturbed. So grab a // lock. - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - *this->profile_lock_ptr_, + this->profile_lock_, -1)); IOP::IOR *tmp_info = 0; @@ -224,7 +218,7 @@ TAO_Stub::object_key (void) const { // Double-checked // FUZZ: disable check_for_ACE_Guard - ACE_Guard<ACE_Lock> obj (*this->profile_lock_ptr_); + ACE_Guard<TAO_SYNCH_MUTEX> obj (this->profile_lock_); // FUZZ: enable check_for_ACE_Guard if (obj.locked () != 0 && this->forward_profiles_ != 0) @@ -517,9 +511,9 @@ TAO_Stub::marshal (TAO_OutputCDR &cdr) } else { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - *this->profile_lock_ptr_, + this->profile_lock_, 0)); ACE_ASSERT(this->forward_profiles_ !=0); @@ -550,17 +544,4 @@ TAO_Stub::marshal (TAO_OutputCDR &cdr) return (CORBA::Boolean) cdr.good_bit (); } -void -TAO_Stub::_incr_refcnt (void) -{ - ++this->refcount_; -} - -void -TAO_Stub::_decr_refcnt (void) -{ - if (--this->refcount_ == 0) - delete this; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h index 66bb2ed25ce..d0b11dd5509 100644 --- a/TAO/tao/Stub.h +++ b/TAO/tao/Stub.h @@ -116,10 +116,6 @@ public: void _incr_refcnt (void); void _decr_refcnt (void); - /// Return the Profile lock. This lock can be used at places where - /// profiles need to be edited. - ACE_Lock *profile_lock (void) const; - /// Manage the base (non-forwarded) profiles. /// Returns a pointer to the profile_in_use object. This object /// retains ownership of this profile. @@ -265,6 +261,8 @@ public: void forwarded_on_exception (bool forwarded); bool forwarded_on_exception () const; + TAO_SYNCH_MUTEX& profile_lock () const; + protected: /// Destructor is to be called only through _decr_refcnt() to @@ -369,7 +367,7 @@ protected: TAO_Profile *profile_in_use_; /// Mutex to protect access to the forwarding profile. - ACE_Lock* profile_lock_ptr_; + mutable TAO_SYNCH_MUTEX profile_lock_; /// Have we successfully talked to the forward profile yet? CORBA::Boolean profile_success_; @@ -403,9 +401,8 @@ protected: */ CORBA::Boolean const collocation_opt_; - - // True if forwarding request upon some specific exceptions - // (e.g. OBJECT_NOT_EXIST) already happened. + /// True if forwarding request upon some specific exceptions + /// (e.g. OBJECT_NOT_EXIST) already happened. ACE_Atomic_Op<TAO_SYNCH_MUTEX, bool> forwarded_on_exception_; }; diff --git a/TAO/tao/Stub.inl b/TAO/tao/Stub.inl index a0ecaed898c..1a756d12e57 100644 --- a/TAO/tao/Stub.inl +++ b/TAO/tao/Stub.inl @@ -1,11 +1,17 @@ // -*- C++ -*- -// // $Id$ #include "tao/ORB_Core.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_INLINE +TAO_SYNCH_MUTEX& +TAO_Stub::profile_lock () const +{ + return this->profile_lock_; +} + ACE_INLINE void TAO_Stub::reset_base (void) { @@ -16,12 +22,6 @@ TAO_Stub::reset_base (void) } -ACE_INLINE ACE_Lock* -TAO_Stub::profile_lock (void) const -{ - return this->profile_lock_ptr_; -} - ACE_INLINE void TAO_Stub::reset_forward (void) { @@ -53,9 +53,9 @@ TAO_Stub::reset_profiles_i (void) ACE_INLINE void TAO_Stub::reset_profiles (void) { - ACE_MT (ACE_GUARD (ACE_Lock, + ACE_MT (ACE_GUARD (TAO_SYNCH_MUTEX, guard, - *this->profile_lock_ptr_)); + this->profile_lock_)); this->reset_profiles_i (); } @@ -156,9 +156,9 @@ TAO_Stub::next_profile_i (void) ACE_INLINE TAO_Profile * TAO_Stub::next_profile (void) { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - *this->profile_lock_ptr_, + this->profile_lock_, 0)); return this->next_profile_i (); } @@ -184,9 +184,9 @@ TAO_Stub::valid_profile (void) const ACE_INLINE TAO_Profile * TAO_Stub::base_profiles (const TAO_MProfile &mprofiles) { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - *this->profile_lock_ptr_, + this->profile_lock_, 0)); // first reset things so we start from scratch! @@ -204,9 +204,9 @@ TAO_Stub::base_profiles (const TAO_MProfile &mprofiles) ACE_INLINE CORBA::Boolean TAO_Stub::next_profile_retry (void) { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - *this->profile_lock_ptr_, + this->profile_lock_, 0)); if (this->profile_success_ && this->forward_profiles_) @@ -347,6 +347,20 @@ bool TAO_Stub::forwarded_on_exception () const return forwarded_on_exception_.value (); } +ACE_INLINE +void +TAO_Stub::_incr_refcnt (void) +{ + ++this->refcount_; +} + +ACE_INLINE +void +TAO_Stub::_decr_refcnt (void) +{ + if (--this->refcount_ == 0) + delete this; +} // --------------------------------------------------------------- |