diff options
author | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-07-17 14:42:07 +0000 |
---|---|---|
committer | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-07-17 14:42:07 +0000 |
commit | e16de8c8c2f4d0a6eb44160dc887fe875c83bb7f (patch) | |
tree | 8d4caf5c22cd4c69e8a455cb79683d909be7122c /TAO/tao/Object.cpp | |
parent | b6b6f7e828f346ac0c38b363fafe25f0a8e0532a (diff) | |
download | ATCD-e16de8c8c2f4d0a6eb44160dc887fe875c83bb7f.tar.gz |
ChangeLogTag: Mon Jul 17 14:40:43 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'TAO/tao/Object.cpp')
-rw-r--r-- | TAO/tao/Object.cpp | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index b08936b74b5..deefa4cbf6c 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -39,7 +39,7 @@ CORBA::Object::~Object (void) if (this->protocol_proxy_) (void) this->protocol_proxy_->_decr_refcnt (); - delete this->refcount_lock_; + delete this->object_init_lock_; } CORBA::Object::Object (TAO_Stub * protocol_proxy, @@ -51,8 +51,8 @@ CORBA::Object::Object (TAO_Stub * protocol_proxy, , ior_ (0) , orb_core_ (orb_core) , protocol_proxy_ (protocol_proxy) - , refcount_ (1) - , refcount_lock_ (0) + , refcount_ () + , object_init_lock_ (0) { /// This constructor should not be called when the protocol proxy is /// null ie. when the object is a LocalObject. Assert that @@ -62,9 +62,12 @@ CORBA::Object::Object (TAO_Stub * protocol_proxy, if (this->orb_core_ == 0) this->orb_core_ = this->protocol_proxy_->orb_core (); - this->refcount_lock_ = + this->object_init_lock_ = this->orb_core_->resource_factory ()->create_corba_object_lock (); + this->refcount_ = + this->orb_core_->resource_factory ()->create_corba_object_refcount (); + // Set the collocation marker on the stub. This may not be news to it. // This may also change the stub's object proxy broker. this->protocol_proxy_->is_collocated (collocated); @@ -80,11 +83,14 @@ CORBA::Object::Object (IOP::IOR *ior, , ior_ (ior) , orb_core_ (orb_core) , protocol_proxy_ (0) - , refcount_ (1) - , refcount_lock_ (0) + , refcount_ () + , object_init_lock_ (0) { - this->refcount_lock_ = + this->object_init_lock_ = this->orb_core_->resource_factory ()->create_corba_object_lock (); + + this->refcount_ = + this->orb_core_->resource_factory ()->create_corba_object_refcount (); } // Too lazy to do this check in every method properly! This is useful @@ -92,14 +98,15 @@ CORBA::Object::Object (IOP::IOR *ior, #define TAO_OBJECT_IOR_EVALUATE \ if (!this->is_evaluated_) \ { \ - ACE_GUARD (ACE_Lock , mon, *this->refcount_lock_); \ - CORBA::Object::tao_object_initialize (this); \ + ACE_GUARD (ACE_Lock , mon, *this->object_init_lock_); \ + if (!this->is_evaluated_) \ + CORBA::Object::tao_object_initialize (this); \ } #define TAO_OBJECT_IOR_EVALUATE_RETURN \ if (!this->is_evaluated_) \ { \ - ACE_GUARD_RETURN (ACE_Lock , mon, *this->refcount_lock_, 0); \ + ACE_GUARD_RETURN (ACE_Lock , mon, *this->object_init_lock_, 0); \ if (!this->is_evaluated_) \ CORBA::Object::tao_object_initialize (this); \ } @@ -110,13 +117,7 @@ CORBA::Object::_add_ref (void) if (this->is_local_) return; - ACE_ASSERT (this->refcount_lock_ != 0); - - ACE_GUARD (ACE_Lock , - mon, - *this->refcount_lock_); - - this->refcount_++; + this->refcount_.increment (); } void @@ -125,20 +126,8 @@ CORBA::Object::_remove_ref (void) if (this->is_local_) return; - ACE_ASSERT (this->refcount_lock_ != 0); - - { - ACE_GUARD (ACE_Lock, - mon, - *this->refcount_lock_); - - this->refcount_--; - - if (this->refcount_ != 0) - return; - } - - ACE_ASSERT (this->refcount_ == 0); + if (this->refcount_.decrement () != 0) + return; delete this; } |