diff options
author | bala <balanatarajan@users.noreply.github.com> | 2003-06-11 20:11:08 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2003-06-11 20:11:08 +0000 |
commit | 4af5cec59d1185b5e933d1544622940e75857764 (patch) | |
tree | 5e4890a005cc329ca78524c5a820a803aceabc05 | |
parent | 046fa39a2ee44fbabaf9476aac199f66bc1af7db (diff) | |
download | ATCD-4af5cec59d1185b5e933d1544622940e75857764.tar.gz |
ChangeLogTag:Wed Jun 11 15:08:29 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 13 | ||||
-rw-r--r-- | TAO/tao/Invocation.cpp | 1 | ||||
-rw-r--r-- | TAO/tao/Profile.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/Profile.h | 2 |
4 files changed, 28 insertions, 4 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 169c091e4ed..3fa2609bb3e 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,16 @@ +Wed Jun 11 15:08:29 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + * tao/Profile.cpp: + * tao/Profile.h: Strategized the lock held by the Profile + class. With this change it is possible to hold a null-lock for + single threaded applications. We can configure the profiles to + have a null lock using -ORBProfileLock null. This fixes BUG + 1527. + + * tao/Invocation.cpp: Fixed a stupid typo that caused the profile's + refcount to be incremented twice in every call. This should fix + a memory leak. + Wed Jun 11 12:15:02 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: Added diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index e3a3f6fa549..46af924c2ea 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -602,7 +602,6 @@ TAO_GIOP_Invocation::profile (TAO_Profile *p) { (void) p->_incr_refcnt (); this->profile_ = p; - (void) this->profile_->_incr_refcnt (); if (tmp) (void) tmp->_decr_refcnt (); diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp index 69ab21cdd43..a74a5a432a8 100644 --- a/TAO/tao/Profile.cpp +++ b/TAO/tao/Profile.cpp @@ -8,6 +8,7 @@ #include "target_specification.h" #include "Object_KeyC.h" #include "ORB_Core.h" +#include "Client_Strategy_Factory.h" #include "ace/CDR_Base.h" #if !defined (__ACE_INLINE__) @@ -33,8 +34,13 @@ TAO_Profile::TAO_Profile (CORBA::ULong tag, , tag_ (tag) , orb_core_ (orb_core) , forward_to_ (0) + , refcount_lock_ (0) , refcount_ (1) { + // @@ NOTE: Need to probably use a different type of lock. + this->refcount_lock_ = + this->orb_core_->client_factory ()->create_profile_lock (); + (void) this->orb_core_->object_key_table ().bind (obj_key, this->ref_object_key_); } @@ -52,8 +58,12 @@ TAO_Profile::TAO_Profile (CORBA::ULong tag, , tag_ (tag) , orb_core_ (orb_core) , forward_to_ (0) + , refcount_lock_ (0) , refcount_ (1) { + // @@ NOTE: Need to probably use a different type of lock. + this->refcount_lock_ = + this->orb_core_->client_factory ()->create_profile_lock (); } TAO_Profile::~TAO_Profile (void) @@ -62,12 +72,14 @@ TAO_Profile::~TAO_Profile (void) delete this->tagged_profile_; this->orb_core_->object_key_table ().unbind (this->ref_object_key_); + + delete this->refcount_lock_; } CORBA::ULong TAO_Profile::_incr_refcnt (void) { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->refcount_lock_, 0); + ACE_GUARD_RETURN (ACE_Lock, guard, *this->refcount_lock_, 0); return this->refcount_++; } @@ -76,7 +88,7 @@ CORBA::ULong TAO_Profile::_decr_refcnt (void) { { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->refcount_lock_, 0); + ACE_GUARD_RETURN (ACE_Lock, mon, *this->refcount_lock_, 0); this->refcount_--; if (this->refcount_ != 0) return this->refcount_; diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h index 8de00a78eef..cce84d31b62 100644 --- a/TAO/tao/Profile.h +++ b/TAO/tao/Profile.h @@ -327,7 +327,7 @@ private: TAO_MProfile* forward_to_; /// Mutex to protect reference count. - TAO_SYNCH_MUTEX refcount_lock_; + ACE_Lock *refcount_lock_; /// Number of outstanding references to this object. CORBA::ULong refcount_; |