diff options
-rw-r--r-- | ChangeLog-99b | 9 | ||||
-rw-r--r-- | ace/Hash_Map_Manager_T.cpp | 8 | ||||
-rw-r--r-- | ace/Map_Manager.cpp | 13 |
3 files changed, 17 insertions, 13 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index 250991e55a7..d6e7d5623e1 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,12 @@ +1999-01-28 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/Hash_Map_Manager_T.cpp (open): this->close_i() must be + called *before* the allocators are changed. + + * ace/Map_Manager.cpp (open): Close the old map (if any) before + creating the new map. This also make open() reentrant. Thanks + to Zoran Ivanovic <zorani@pathcom.com> for reporting this bug. + Thu Jan 28 19:08:25 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * ace/Active_Map_Manager_T.h: diff --git a/ace/Hash_Map_Manager_T.cpp b/ace/Hash_Map_Manager_T.cpp index 2037b29b2a8..1921304ccb1 100644 --- a/ace/Hash_Map_Manager_T.cpp +++ b/ace/Hash_Map_Manager_T.cpp @@ -118,6 +118,10 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + // Calling this->close_i () to ensure we release previous allocated + // memory before allocating new one. + this->close_i (); + if (alloc == 0) alloc = ACE_Allocator::instance (); @@ -129,10 +133,6 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). ACE_ASSERT (size != 0); - // Calling this->close_i () to ensure we release previous allocated - // memory before allocating new one. - this->close_i (); - return this->create_buckets (size); } diff --git a/ace/Map_Manager.cpp b/ace/Map_Manager.cpp index 4ff94017a0b..781b5af7d53 100644 --- a/ace/Map_Manager.cpp +++ b/ace/Map_Manager.cpp @@ -29,12 +29,15 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Map_Iterator) ACE_ALLOC_HOOK_DEFINE(ACE_Map_Reverse_Iterator) - template <class EXT_ID, class INT_ID, class ACE_LOCK> int +template <class EXT_ID, class INT_ID, class ACE_LOCK> int ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::open (size_t size, ACE_Allocator *alloc) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + // Close old map (if any). + this->close_i (); + // Use the user specified allocator or the default singleton one. if (alloc == 0) alloc = ACE_Allocator::instance (); @@ -45,14 +48,6 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::open (size_t size, // happen. ACE_ASSERT (size != 0); - // Reset circular occupied list. - this->occupied_list_.next (this->occupied_list_id ()); - this->occupied_list_.prev (this->occupied_list_id ()); - - // Reset circular free list. - this->free_list_.next (this->free_list_id ()); - this->free_list_.prev (this->free_list_id ()); - // Resize from 0 to <size>. Note that this will also set up the // circular free list. return this->resize_i (size); |