diff options
author | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-02-11 11:33:12 +0000 |
---|---|---|
committer | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-02-11 11:33:12 +0000 |
commit | 4df04cc27ef1e77bcc941afaba7d4c943b98a936 (patch) | |
tree | 5054c2bde24d048d4790ff659b61be0838cd0d69 /TAO/tao/ObjectKey_Table.cpp | |
parent | b723802f85ac66026a503827677a2fb1e9a77933 (diff) | |
download | ATCD-4df04cc27ef1e77bcc941afaba7d4c943b98a936.tar.gz |
Fri Feb 11 11:16:00 UTC 2011 Martin Corino <mcorino@remedy.nl>
Merged changes from Remedy work branch.
Diffstat (limited to 'TAO/tao/ObjectKey_Table.cpp')
-rw-r--r-- | TAO/tao/ObjectKey_Table.cpp | 76 |
1 files changed, 7 insertions, 69 deletions
diff --git a/TAO/tao/ObjectKey_Table.cpp b/TAO/tao/ObjectKey_Table.cpp index b4a287c1443..c4488fb8f33 100644 --- a/TAO/tao/ObjectKey_Table.cpp +++ b/TAO/tao/ObjectKey_Table.cpp @@ -4,6 +4,10 @@ #include "tao/ORB_Core.h" #include "tao/Refcounted_ObjectKey.h" +#if !defined (__ACE_INLINE__) +# include "tao/ObjectKey_Table.inl" +#endif /* ! __ACE_INLINE__ */ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL bool @@ -30,8 +34,7 @@ TAO::Less_Than_ObjectKey::operator () (const TAO::ObjectKey &lhs, /********************************************************/ TAO::ObjectKey_Table::ObjectKey_Table (void) - : lock_ (0) - , table_ () + : table_ () { } @@ -39,71 +42,6 @@ TAO::ObjectKey_Table::ObjectKey_Table (void) TAO::ObjectKey_Table::~ObjectKey_Table (void) { this->table_.close (); - delete this->lock_; -} - -int -TAO::ObjectKey_Table::init (TAO_ORB_Core *oc) -{ - /// Create the lock that is needed for internal usage. - this->lock_ = - oc->resource_factory ()->create_object_key_table_lock (); - - return 0; -} - -int -TAO::ObjectKey_Table::bind (const TAO::ObjectKey &key, - TAO::Refcounted_ObjectKey *&key_new) - -{ - key_new = 0; - - int retval = 0; - - { - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->lock_, - 0); - - // This is a tradeoff.. We could avoid this two stage process of - // using a find () and then a bind () , which would make things - // efficient. BUT we may have to do allocation upfront and delete if - // bind () returns with an entry. We take one of the routes that - // avoids allocation. - retval = this->table_.find (key, - key_new); - - if (retval == -1) - { - return this->bind_i (key, - key_new); - } - - (void) key_new->incr_refcount (); - } - - return retval; -} - -int -TAO::ObjectKey_Table::unbind (TAO::Refcounted_ObjectKey *&key_new) - -{ - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->lock_, - 0); - - // If the refcount has dropped to 1, just go ahead and unbind it - // from the table. - if (key_new && key_new->decr_refcount () == 1) - { - return this->unbind_i (key_new); - } - - return 0; } int @@ -111,9 +49,9 @@ TAO::ObjectKey_Table::destroy (void) { if (this->table_.current_size ()) { - ACE_GUARD_RETURN (ACE_Lock, + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, - *this->lock_, + this->lock_, 0); TABLE::ITERATOR end_iter = this->table_.end (); |