summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2005-07-16 15:38:42 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2005-07-16 15:38:42 +0000
commit0d9a1ecebde1dbf6ea37ed69f45dd58b9659eae5 (patch)
tree95a35487bcdbd20da7814875a65ffc6ddea1d36b /TAO
parenta4291bdc340db44e9ebf04743c882fa585b83083 (diff)
downloadATCD-0d9a1ecebde1dbf6ea37ed69f45dd58b9659eae5.tar.gz
ChangeLogTag:Fri Jul 15 16:35:37 2005 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog7
-rw-r--r--TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h3
-rw-r--r--TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.cpp32
-rw-r--r--TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h6
4 files changed, 33 insertions, 15 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 0ebe978fddd..707b19cd0e6 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,10 @@
+Sat Jul 16 10:24:36 2005 Douglas C. Schmidt <schmidt@cs.wustl.edu>
+
+ * orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.{cpp,h}: Added
+ a lock to prevent race conditions. Thanks to Frank Hunleth
+ <frank@hunleth.com> and Felix Perez Alamillo
+ <fpalamillo@indra.es> for helping with this.
+
Sat Jul 16 02:18:12 UTC 2005 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_visitor_valuebox/valuebox_ci.cpp:
diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h
index ebd50b066be..7b748ac0d15 100644
--- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h
+++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h
@@ -10,7 +10,6 @@
*/
//=============================================================================
-
#ifndef TAO_PG_PROPERTY_MANAGER_H
#define TAO_PG_PROPERTY_MANAGER_H
@@ -31,11 +30,9 @@
#include "ace/Functor.h"
#include "ace/Hash_Map_Manager_T.h"
-
/// Forward declarations.
class TAO_PG_ObjectGroupManager;
-
/**
* @class TAO_PG_PropertyManager
*
diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.cpp
index 7dea68ac35e..384cec206c6 100644
--- a/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.cpp
+++ b/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.cpp
@@ -47,6 +47,10 @@ TAO_Portable_Group_Map::add_groupid_objectkey_pair (
ACE_ENV_ARG_DECL
)
{
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_);
+
Map_Entry *new_entry;
// We take ownership of the group_id memory. Be sure we don't
@@ -56,10 +60,10 @@ TAO_Portable_Group_Map::add_groupid_objectkey_pair (
ACE_NEW_THROW_EX (new_entry,
Map_Entry (),
CORBA::NO_MEMORY (
- CORBA::SystemException::_tao_minor_code (
- TAO::VMCID,
- ENOMEM),
- CORBA::COMPLETED_NO));
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
ACE_CHECK;
// Fill out the entry.
@@ -110,6 +114,10 @@ TAO_Portable_Group_Map::dispatch (PortableGroup::TagGroupTaggedComponent* group_
CORBA::Object_out forward_to
ACE_ENV_ARG_DECL)
{
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_);
+
// Look up the GroupId.
Map_Entry *entry = 0;
if (this->map_.find (group_id,
@@ -143,6 +151,11 @@ TAO_Portable_Group_Map::dispatch (PortableGroup::TagGroupTaggedComponent* group_
u_long
TAO_GroupId_Hash::operator () (const PortableGroup::TagGroupTaggedComponent *id) const
{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_,
+ 0);
+
u_long hash =
ACE::hash_pjw ((const char *) id->group_domain_id,
ACE_OS::strlen ((const char *) id->group_domain_id));
@@ -162,13 +175,16 @@ TAO_GroupId_Equal_To::operator () (
const PortableGroup::TagGroupTaggedComponent *lhs,
const PortableGroup::TagGroupTaggedComponent *rhs) const
{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_,
+ -1);
return
- (ACE_OS::strcmp (lhs->group_domain_id, rhs->group_domain_id) == 0) &&
- (lhs->object_group_id == rhs->object_group_id) &&
- (lhs->object_group_ref_version == rhs->object_group_ref_version);
+ ACE_OS::strcmp (lhs->group_domain_id, rhs->group_domain_id) == 0)
+ && lhs->object_group_id == rhs->object_group_id
+ && lhs->object_group_ref_version == rhs->object_group_ref_version;
}
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Hash_Map_Entry<PortableGroup::TagGroupTaggedComponent *, TAO_Portable_Group_Map::Map_Entry *>;
diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h b/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h
index e98a74c367d..39ff7d251eb 100644
--- a/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h
+++ b/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h
@@ -119,15 +119,13 @@ public:
typedef GroupId_Table::iterator Iterator;
protected:
- /// @@ Frank: This class will need a mutex to protect
- /// this eventually...
+ /// Lock used to synchronize access to map_.
+ TAO_SYNCH_MUTEX lock_;
/// Id map.
GroupId_Table map_;
};
-
-
//#if defined (__ACE_INLINE__)
//# include "Portable_Group_Map.i"
//#endif /* __ACE_INLINE__ */