summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-12-09 21:56:38 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-12-09 21:56:38 +0000
commit5fd123136b6dfcd0a0919bcb0ff2d16ddeb2daa8 (patch)
tree2b7eb550941e527315d83c04fbf81af8bfa300d6
parent195e079a3e6af4188ae91c41294e870e3f2a92d8 (diff)
downloadATCD-5fd123136b6dfcd0a0919bcb0ff2d16ddeb2daa8.tar.gz
ChangeLogTag:Thu Dec 09 15:53:20 1999 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r--ChangeLog-99b83
-rw-r--r--TAO/ChangeLog-99c8
-rwxr-xr-xTAO/examples/Load_Balancing_persistent/Load_Balancer_i.cpp214
-rw-r--r--TAO/examples/POA/DSI/Database_i.cpp4
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp2
-rw-r--r--TAO/tao/default_resource.cpp2
-rw-r--r--ace/Based_Pointer_T.h8
-rw-r--r--ace/Configuration.cpp4
-rw-r--r--ace/Malloc.cpp138
-rw-r--r--ace/Malloc.h352
-rw-r--r--ace/Malloc.i39
-rw-r--r--ace/Malloc_T.cpp395
-rw-r--r--ace/Malloc_T.h130
-rw-r--r--ace/Malloc_T.i92
-rw-r--r--ace/Naming_Context.cpp4
-rw-r--r--ace/Service_Config.cpp2
-rw-r--r--ace/System_Time.cpp2
-rw-r--r--ace/Template_Instantiations.cpp7
-rw-r--r--docs/tutorials/021/client.cpp2
-rw-r--r--docs/tutorials/021/server.cpp2
-rw-r--r--examples/Reactor/Misc/demuxing.dsp202
-rw-r--r--examples/Shared_Malloc/Malloc.cpp12
-rw-r--r--examples/Shared_Malloc/test_persistence.cpp4
-rw-r--r--examples/System_V_IPC/SV_Semaphores/Semaphores.cpp24
-rw-r--r--examples/System_V_IPC/SV_Semaphores/Semaphores_1.cpp4
-rw-r--r--examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp2
-rw-r--r--tests/Malloc_Test.cpp18
-rw-r--r--tests/SV_Shared_Memory_Test.cpp2
28 files changed, 1161 insertions, 597 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index d7023b9245b..8f428045a13 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,86 @@
+Thu Dec 09 15:53:20 1999 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ace/Malloc.cpp:
+ * ace/Malloc.h:
+ * ace/Malloc.i: Separated the control block implementation into
+ "position independent control block" and "lean and mean control
+ block." Each control block implementation has its own
+ definitions of Malloc_Header and Name_Node as inner classes.
+ ACE_Control_Block implements the "old, lean and mean" control
+ structure for ACE_Malloc_T and ACE_PI_Control_Block implements
+ the "new, position independent" control structure for
+ ACE_Malloc_T.
+
+ Added several macros to finer control the padding and alignment
+ because calculating the padding requires using some operations
+ that can not be evaluated during the compile time and the
+ original padding length calculation don't always work. Usually,
+ you don't have to worry about the padding. But if you are
+ interested in tweaking these parameters, here are some hints.
+
+ - (ACE_MALLOC_PADDING): defines the minimum size of a Malloc_Header.
+ The actual size of Malloc_Header should always be the a multiple
+ of ACE_MALLOC_ALIGN and may be larger then ACE_MALLOC_PADDING.
+
+ - (ACE_MALLOC_PADDING_SIZE): define the actual size of the array
+ of long used to pad the ACE_Control_Block::ACE_Malloc_Header.
+ If it is not defined by the user, ACE will try to calculate it
+ for you. If it is defined as 0, there'll be no padding at all.
+ This macro is compiler/platform dependent.
+
+ - (ACE_CONTROL_BLOCK_ALIGN_LONGS): define the actual size of the
+ array of long used to pad the ACE_Control_Block so that the
+ first Malloc_Header always starts from the alignment boundary.
+ If it is not defined by the user, ACE will try to calculate it
+ for you. If it is defined as 0, there'll be no padding at all.
+ This macro is compiler/platform dependent.
+
+ - (ACE_PI_MALLOC_PADDING_SIZE): similar to ACE_MALLOC_PADDING_SIZE
+ but applied to ACE_PI_Control_Block::ACE_Malloc_Header.
+
+ - (ACE_PI_CONTROL_BLOCK_ALIGN_LONGS): similar to
+ ACE_CONTROL_BLOCK_ALIGN_LONGS but applied to
+ ACE_PI_Control_Block.
+
+ * ace/Malloc_T.cpp:
+ * ace/Malloc_T.h:
+ * ace/Malloc_T.i: Parameterized the type of control block used in
+ ACE_Malloc, which is now renamed to ACE_Malloc_T, as a template
+ parameter so that we can control tradeoff between efficiency and
+ flexibility.
+
+ Another ACE_Malloc template class was added which simply use
+ ACE_Malloc_T with ACE_Control_Block as its internal control
+ structure so that we don't have to change the existing programs
+ using ACE_Malloc. However, for platforms/compilers using
+ explicit template instantiation, you still need to add the
+ instantiations for the based template class. For example, if
+ you instantiated "ACE_Malloc<A,B>", you'll need to add
+ "ACE_Malloc_T<A,B,ACE_Control_Block>". Likewise for
+ ACE_Malloc_LIFO_Iterator and ACE_Malloc_FIFO_Iterator.
+
+ * ace/Based_Pointer_T.h: Renamed arguments "overload" to "o". KCC
+ complained about using "overload" as variable names
+
+ * ace/Configuration.cpp:
+ * ace/Naming_Context.cpp:
+ * ace/Service_Config.cpp:
+ * ace/System_Time.cpp:
+ * ace/Template_Instantiations.cpp:
+ * docs/tutorials/021/client.cpp:
+ * docs/tutorials/021/server.cpp:
+ * examples/Reactor/Misc/demuxing.dsp:
+ * examples/Shared_Malloc/Malloc.cpp:
+ * examples/Shared_Malloc/test_persistence.cpp:
+ * examples/System_V_IPC/SV_Semaphores/Semaphores.cpp:
+ * examples/System_V_IPC/SV_Semaphores/Semaphores_1.cpp:
+ * examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp:
+ * performance-tests/TCP/TCP.dsp:
+ * tests/Malloc_Test.cpp:
+ * tests/SV_Shared_Memory_Test.cpp: Added explicit template
+ instantiations for base malloc class in corresponding with the
+ above change.
+
Thu Dec 09 15:40:03 1999 David L. Levine <levine@cs.wustl.edu>
* ace/OS.i (mmap): on LynxOS, fixed use of file_mapping
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index 0ffc2d926fb..92fc79bdc19 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,11 @@
+Thu Dec 09 15:53:20 1999 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * examples/Load_Balancing_persistent/Load_Balancer_i.cpp:
+ * examples/POA/DSI/Database_i.cpp:
+ * orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp:
+ * tao/default_resource.cpp: Added template instantiation for
+ ACE_Malloc_T in correspond to the change in ACE.
+
Thu Dec 9 14:57:16 1999 Jeff Parsons <parsons@cs.wustl.edu>
* performance-tests/RTCorba/Oneway/Reliable/run_test.pl:
diff --git a/TAO/examples/Load_Balancing_persistent/Load_Balancer_i.cpp b/TAO/examples/Load_Balancing_persistent/Load_Balancer_i.cpp
index 46933936417..907b96d8deb 100755
--- a/TAO/examples/Load_Balancing_persistent/Load_Balancer_i.cpp
+++ b/TAO/examples/Load_Balancing_persistent/Load_Balancer_i.cpp
@@ -8,7 +8,7 @@ const char *rr_name_bind = "RR_Group";
const char *random_name_bind = "Random_Group";
// Name binding for the location of the Random info in the mem pool
-
+
const char *flags_name_bind = "FLAGS";
// Name binding for the location of the flags info in the mem pool
@@ -52,8 +52,8 @@ Object_Group_Factory_i::make_round_robin (const char * id,
ACE_THROW_SPEC ((CORBA::SystemException,
Load_Balancer::duplicate_group))
{
-
- if (this->mem_pool_->find (rr_name_bind,
+
+ if (this->mem_pool_->find (rr_name_bind,
(void *&)this->rr_groups_) == -1)
{
void *hash_map = this->mem_pool_->malloc (sizeof (HASH_MAP));
@@ -89,19 +89,19 @@ Object_Group_Factory_i::unbind_round_robin (const char * id,
(void *&)this->rr_groups_) == -1)
ACE_THROW (Load_Balancer::no_such_group ());
}
-
+
char *int_id = 0;
-
+
// Throw an exception if not found in the HASH MAP
if (this->rr_groups_->find (ACE_const_cast (char *, id),
this->mem_pool_) < 0)
ACE_THROW (Load_Balancer::no_such_group ());
-
+
// Unbind the entry
this->rr_groups_->unbind (ACE_const_cast (char *, id),
int_id,
this->mem_pool_);
-
+
// Free the memory from the pool
this->mem_pool_->free (int_id - (ACE_OS::strlen (id) + 1));
@@ -112,10 +112,10 @@ Object_Group_Factory_i::unbind_round_robin (const char * id,
(void *&)this->flags_) == -1)
return;
}
-
+
// Bump down the flags value
--this->flags_;
-
+
}
Load_Balancer::Object_Group_ptr
@@ -124,11 +124,11 @@ Object_Group_Factory_i::make_random (const char * id,
ACE_THROW_SPEC ((CORBA::SystemException,
Load_Balancer::duplicate_group))
{
-
+
if (this->mem_pool_->find (random_name_bind, (void * &)this->random_groups_) == -1)
{
void *hash_map = this->mem_pool_->malloc (sizeof (HASH_MAP));
-
+
ACE_NEW_THROW_EX (this->random_groups_,
(hash_map) HASH_MAP (this->mem_pool_),
CORBA::NO_MEMORY ());
@@ -162,9 +162,9 @@ Object_Group_Factory_i::unbind_random (const char * id,
(void *&)this->random_groups_) == -1)
ACE_THROW (Load_Balancer::no_such_group ());
}
-
+
char *int_id = 0;
-
+
// Throw an exception if not found in the HASH MAP
if (this->random_groups_->find (ACE_const_cast (char *, id),
this->mem_pool_) < 0)
@@ -177,7 +177,7 @@ Object_Group_Factory_i::unbind_random (const char * id,
// Free the memory from the pool
this->mem_pool_->free (int_id - (ACE_OS::strlen (id) + 1));
-
+
// Change the FLAGS variable
if (this->flags_ == 0)
{
@@ -185,7 +185,7 @@ Object_Group_Factory_i::unbind_random (const char * id,
(void *&)this->flags_) == -1)
return;
}
-
+
// Bump down the flags value
this->flags_ -= 2;
}
@@ -205,7 +205,7 @@ Object_Group_Factory_i::make_group (int random,
// Check to make sure we don't already have a group with the same
// <id>.
-
+
if (random)
{
if (this->random_groups_->find (ACE_const_cast (char *,id),
@@ -235,61 +235,61 @@ Object_Group_Factory_i::make_group (int random,
this->poa_.in ()),
CORBA::NO_MEMORY ());
ACE_CHECK_RETURN (group._retn ());
-
+
// Register with the poa, begin using ref. counting.
group = group_servant->_this (ACE_TRY_ENV);
ACE_CHECK_RETURN (group._retn ());
-
+
group_servant->_remove_ref (ACE_TRY_ENV);
ACE_CHECK_RETURN (Load_Balancer::Object_Group::_nil ());
-
- CORBA::String_var ior =
+
+ CORBA::String_var ior =
this->orb_->object_to_string (group.in (),
ACE_TRY_ENV);
ACE_CHECK_RETURN (Load_Balancer::Object_Group::_nil ());
-
+
// Calculate and allocate the memory we need to store this name to
// object binding.
size_t id_len = ACE_OS::strlen (id) + 1;
size_t kind_len = ACE_OS::strlen (ior.in ()) + 1;
-
+
char *ptr = (char *) this->mem_pool_->malloc (id_len + kind_len);
if (ptr == 0)
ACE_THROW_RETURN (CORBA::NO_MEMORY (),
Load_Balancer::Object_Group::_nil ());
-
+
char * id_ptr = ptr;
char * ior_ptr = ptr + id_len;
-
+
ACE_OS::strcpy (id_ptr, id);
ACE_OS::strcpy (ior_ptr, ior.in ());
-
+
// Store the results here
CORBA::Long result = 0;
-
+
// Make an entry in appropriate map of groups.
if (random)
{
- result = this->random_groups_->bind (id_ptr,
+ result = this->random_groups_->bind (id_ptr,
ior_ptr,
this->mem_pool_);
}
else
{
- result = this->rr_groups_->bind (id_ptr,
+ result = this->rr_groups_->bind (id_ptr,
ior_ptr,
this->mem_pool_);
}
-
+
// Update the value of flags_
this->update_flags (random,
ACE_TRY_ENV);
ACE_CHECK_RETURN (Load_Balancer::Object_Group::_nil ());
-
+
if (result == -1)
{
// For some reason the bind failed. Free our
@@ -297,12 +297,12 @@ Object_Group_Factory_i::make_group (int random,
this->mem_pool_->free ((void *) ptr);
ACE_THROW_RETURN (Load_Balancer::duplicate_group (),
Load_Balancer::Object_Group::_nil ());
-
+
}
-
+
// Return.
ACE_DEBUG ((LM_DEBUG, "Successfully created new group: %s\n", id));
-
+
return group._retn ();
}
@@ -331,7 +331,7 @@ Object_Group_Factory_i::resolve (const char * id,
// MMAP file for the relevant info..
if (!this->rr_groups_)
{
- if (this->mem_pool_->find (rr_name_bind,
+ if (this->mem_pool_->find (rr_name_bind,
(void *&)this->rr_groups_) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -343,36 +343,36 @@ Object_Group_Factory_i::resolve (const char * id,
if (!this->random_groups_)
{
- if (this->mem_pool_->find (random_name_bind,
+ if (this->mem_pool_->find (random_name_bind,
(void *&)this->random_groups_) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ASYS_TEXT ("(%N|%l) The factory does not have any references "),
ASYS_TEXT ("to the group that you have sought \n\n")),
0);
-
+
}
}
if (!this->flags_)
{
- this->mem_pool_->find (flags_name_bind,
+ this->mem_pool_->find (flags_name_bind,
(void *&)this->flags_);
this->update_objects (ACE_TRY_ENV);
}
- char *ior = 0;
+ char *ior = 0;
- if (rr_groups_->find (ACE_const_cast (char *, id),
+ if (rr_groups_->find (ACE_const_cast (char *, id),
ior,
this->mem_pool_) == -1
- && random_groups_->find (ACE_const_cast (char *, id),
+ && random_groups_->find (ACE_const_cast (char *, id),
ior,
this->mem_pool_) == -1)
ACE_THROW_RETURN (Load_Balancer::no_such_group (),
0);
-
- CORBA_Object_var objref =
+
+ CORBA_Object_var objref =
this->orb_->string_to_object (ior,
ACE_TRY_ENV);
ACE_CHECK_RETURN (Load_Balancer::Object_Group::_nil ());
@@ -380,7 +380,7 @@ Object_Group_Factory_i::resolve (const char * id,
Load_Balancer::Object_Group_ptr
object_group = Load_Balancer::Object_Group::_narrow (objref,
ACE_TRY_ENV);
-
+
ACE_CHECK_RETURN (Load_Balancer::Object_Group::_nil ());
@@ -394,7 +394,7 @@ Object_Group_Factory_i::resolve (const char * id,
ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
ACE_OS::printf ("*=*=*=*=Aggregated result *=*=*=*=*= \n");
this->throughput_.dump_results ("Aggregated", gsf);
-
+
#endif /*DOORS_MEASURE_STATS*/
return object_group;
@@ -435,7 +435,7 @@ Object_Group_Factory_i::list_groups (int random,
{
group_iter->next (hash_entry);
group_iter->advance ();
-
+
(*list)[i] = ACE_OS::strdup (hash_entry->ext_id_);
}
@@ -464,22 +464,22 @@ Object_Group_Factory_i::update_flags (int random,
//First check whether we have memory for flags_
if (!this->flags_)
{
- if (this->mem_pool_->find (flags_name_bind,
+ if (this->mem_pool_->find (flags_name_bind,
(void *&) this->flags_) == -1)
{
- void *value =
+ void *value =
this->mem_pool_->malloc (sizeof (CORBA::Short));
ACE_NEW_THROW_EX (this->flags_,
(value) CORBA::Short (0),
CORBA::NO_MEMORY ());
ACE_CHECK;
-
+
// Initialize the variable
- this->mem_pool_->bind (flags_name_bind,
+ this->mem_pool_->bind (flags_name_bind,
(void *)this->flags_);
}
}
-
+
CORBA::Short val = *(this->flags_);
switch (val)
{
@@ -497,7 +497,7 @@ Object_Group_Factory_i::update_flags (int random,
if (!random)
*(this->flags_) = 3;
break;
-
+
}
}
@@ -509,8 +509,8 @@ Object_Group_Factory_i::update_objects (CORBA::Environment &ACE_TRY_ENV)
Object_Group_i *group_servant_rep = 0;
// Check the value of of flags_ & do the instantiation and
- // registration
-
+ // registration
+
switch (*(this->flags_))
{
case 1:
@@ -542,19 +542,19 @@ Object_Group_Factory_i::update_objects (CORBA::Environment &ACE_TRY_ENV)
group_servant->_this ();
break;
}
-
+
}
Object_Group_i::Object_Group_i (const char * id,
PortableServer::POA_ptr poa)
- :poa_ (PortableServer::POA::_duplicate (poa)),
+ :poa_ (PortableServer::POA::_duplicate (poa)),
member_id_list_ (0),
members_ (0),
id_ (id),
- allocator_ (0)
+ allocator_ (0)
{
-
+
if (!this->allocator_)
{
ACE_MMAP_Memory_Pool::OPTIONS options (ACE_DEFAULT_BASE_ADDR);
@@ -576,7 +576,7 @@ Object_Group_i::~Object_Group_i (void)
{
delete (iter.next ());
} while (iter.advance ());
-
+
delete this->allocator_;
}
@@ -603,12 +603,12 @@ Object_Group_i::bind (const Load_Balancer::Member & member,
ACE_THROW_SPEC ((CORBA::SystemException,
Load_Balancer::duplicate_member))
{
-
+
if (this->members_ == 0)
{
ACE_CString id = this->id (ACE_TRY_ENV);
ACE_CHECK;
-
+
id += server_id_name_bind;
if (this->allocator_->find (id.c_str (), (void *&)this->members_) == -1)
@@ -618,32 +618,32 @@ Object_Group_i::bind (const Load_Balancer::Member & member,
(hash_map) HASH_MAP (this->allocator_),
CORBA::NO_MEMORY ());
ACE_CHECK;
-
+
// Bind it in the mem pool with a name
if (this->allocator_->bind (id.c_str (),
(void *)this->members_) != 0)
{
ACE_ERROR ((LM_ERROR,
"Unable to bind \n"));
-
+
}
}
}
- // Check whether the element already exists..
- if (this->members_->find (ACE_const_cast (char *,
- (const char *) member.id),
+ // Check whether the element already exists..
+ if (this->members_->find (ACE_const_cast (char *,
+ (const char *) member.id),
this->allocator_) == 0)
ACE_THROW (Load_Balancer::duplicate_member ());
-
+
size_t id_len = ACE_OS::strlen (member.id) + 1;
size_t ref_len = ACE_OS::strlen (member.obj) + 1;
char *mem_alloc = (char *)this->allocator_->malloc (id_len + ref_len);
-
+
if (mem_alloc == 0)
ACE_THROW (CORBA::NO_MEMORY ());
-
+
char **id_ptr = (char **)this->allocator_->malloc (sizeof (char *));
*id_ptr = mem_alloc;
char *ior_ptr = mem_alloc + id_len;
@@ -651,25 +651,25 @@ Object_Group_i::bind (const Load_Balancer::Member & member,
ACE_OS::strcpy (*id_ptr, member.id);
ACE_OS::strcpy (ior_ptr, member.obj);
-
+
// Insert new member into <members_> and check for duplicates/failures.
int result = this->members_->trybind (*id_ptr,
ior_ptr);
-
+
if (result == 1)
ACE_THROW (Load_Balancer::duplicate_member ());
else if (result == -1)
ACE_THROW (CORBA::INTERNAL ());
// Search the list first from the mem mapp pool and then Insert new
- // member's id into <member_id_list_>.
+ // member's id into <member_id_list_>.
ACE_CString id = dll_name_bind;
id += this->id (ACE_TRY_ENV);
-
- if (this->allocator_->find (id.c_str (),
+
+ if (this->allocator_->find (id.c_str (),
(void *&)this->member_id_list_)
== -1)
{
@@ -678,7 +678,7 @@ Object_Group_i::bind (const Load_Balancer::Member & member,
(dll_list) LIST (this->allocator_),
CORBA::NO_MEMORY ());
ACE_CHECK;
-
+
// Bind it in the mem pool with a name
if (this->allocator_->bind (id.c_str (),
(void *)this->member_id_list_) != 0)
@@ -688,7 +688,7 @@ Object_Group_i::bind (const Load_Balancer::Member & member,
return;
}
}
-
+
if (member_id_list_->insert_tail (id_ptr) == 0)
ACE_THROW (CORBA::NO_MEMORY ());
@@ -708,43 +708,43 @@ Object_Group_i::unbind (const char * id,
{
ACE_CString id = this->id (ACE_TRY_ENV);
id += server_id_name_bind;
-
- if (this->allocator_->find (id.c_str (),
+
+ if (this->allocator_->find (id.c_str (),
(void *&)this->members_) == -1)
{
ACE_THROW (Load_Balancer::no_such_member);
}
}
// Check to make sure we have it.
- if (this->members_->find (ACE_const_cast (char *, id),
+ if (this->members_->find (ACE_const_cast (char *, id),
this->allocator_) == -1)
ACE_THROW (Load_Balancer::no_such_member ());
// Remove all entries for this member.
- this->members_->unbind (ACE_const_cast(char *, id),
+ this->members_->unbind (ACE_const_cast(char *, id),
this->allocator_);
if (this->member_id_list_ == 0)
{
ACE_CString id = dll_name_bind;
id += this->id (ACE_TRY_ENV);
-
- if (this->allocator_->find (id.c_str (),
+
+ if (this->allocator_->find (id.c_str (),
(void *&)this->member_id_list_)
== -1)
ACE_THROW (Load_Balancer::no_such_member);
-
+
}
-
+
Object_Group_i::ITERATOR iter (*(this->member_id_list_));
while (ACE_OS::strcmp (id,*(iter.next ())))
iter.advance ();
this->allocator_->free ((void *) iter.next ());
-
+
iter.remove ();
}
@@ -755,7 +755,7 @@ Object_Group_i::resolve_with_id (const char * id,
Load_Balancer::no_such_member))
{
CORBA::String_var ior;
-
+
if (this->members_->find (ACE_const_cast (char *,
id),
@@ -764,9 +764,9 @@ Object_Group_i::resolve_with_id (const char * id,
0);
char *retn_ptr = CORBA::string_dup (ior.in ());
-
+
return retn_ptr;
-
+
}
Load_Balancer::Member_ID_List *
@@ -777,7 +777,7 @@ Object_Group_i::members (CORBA::Environment &ACE_TRY_ENV)
this->read_from_memory (ACE_TRY_ENV);
ACE_CHECK_RETURN (0);
-
+
// Figure out the length of the list.
CORBA::ULong len = this->members_->current_size ();
@@ -828,26 +828,26 @@ Object_Group_i::read_from_memory (CORBA::Environment &ACE_TRY_ENV)
// Sanity check needs to be done in all the places
ACE_CString id = this->id (ACE_TRY_ENV);
ACE_CHECK;
-
+
if (!this->members_)
{
id += server_id_name_bind;
-
- if (this->allocator_->find (id.c_str (),
+
+ if (this->allocator_->find (id.c_str (),
(void *&)this->members_) == -1)
{
ACE_ERROR ((LM_ERROR,
"Unable to find tha HASH MAP in the MMAP file \n"));
}
}
-
+
if (!this->member_id_list_)
{
id = dll_name_bind;
id += this->id (ACE_TRY_ENV);
-
- if (this->allocator_->find (id.c_str (),
+
+ if (this->allocator_->find (id.c_str (),
(void *&)this->member_id_list_) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -892,7 +892,7 @@ Random_Object_Group::resolve (CORBA::Environment &ACE_TRY_ENV)
// Return the object reference corresponding to the found id to the
// client.
char *objref = 0;
- this->members_->find (*id,
+ this->members_->find (*id,
objref,
this->allocator_);
char *string_ptr = CORBA::string_dup (objref);
@@ -914,7 +914,7 @@ RR_Object_Group::resolve (CORBA::Environment &ACE_TRY_ENV)
char *objref = 0;
this->read_from_memory (ACE_TRY_ENV);
- ACE_CHECK_RETURN (0);
+ ACE_CHECK_RETURN (0);
size_t group_size = this->members_->current_size ();
if (group_size == 0)
@@ -924,22 +924,22 @@ RR_Object_Group::resolve (CORBA::Environment &ACE_TRY_ENV)
// Get the id of the member to return to the client.
char **id;
this->member_id_list_->get (id, next_);
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"In RR Group resolved to: %s\n", *id));
// Adjust <next_> for the next invocation.
next_ = (next_ + 1) % group_size;
-
+
// Return the object reference corresponding to the found id to the client.
- if (this->members_->find (*id,
+ if (this->members_->find (*id,
objref,
this->allocator_) == -1)
ACE_THROW_RETURN (CORBA::INTERNAL (),
0);
char *retn_ptr = CORBA::string_dup (objref);
-
+
return retn_ptr;
}
@@ -954,8 +954,8 @@ RR_Object_Group::unbind (const char *id,
{
ACE_CString id = this->id (ACE_TRY_ENV);
id += server_id_name_bind;
-
- if (this->allocator_->find (id.c_str (),
+
+ if (this->allocator_->find (id.c_str (),
(void *&)this->members_) == -1)
{
ACE_THROW (Load_Balancer::no_such_member);
@@ -977,12 +977,12 @@ RR_Object_Group::unbind (const char *id,
{
ACE_CString id = dll_name_bind;
id += this->id (ACE_TRY_ENV);
-
- if (this->allocator_->find (id.c_str (),
+
+ if (this->allocator_->find (id.c_str (),
(void *&)this->member_id_list_)
== -1)
ACE_THROW (Load_Balancer::no_such_member);
-
+
}
size_t position = 0;
@@ -996,7 +996,7 @@ RR_Object_Group::unbind (const char *id,
iter.remove ();
int curr_size = this->members_->current_size ();
-
+
// Update <next_> if necessary to reflect the deletion.
if (position < next_)
this->next_--;
@@ -1010,6 +1010,7 @@ RR_Object_Group::unbind (const char *id,
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_Memory_Pool, ACE_Thread_Mutex> >;
template class ACE_Malloc<ACE_MMAP_Memory_Pool, ACE_Thread_Mutex>;
+template class ACE_Malloc_T<ACE_MMAP_Memory_Pool, ACE_Thread_Mutex, ACE_Control_Block>;
template class ACE_Hash_Map_With_Allocator<char *, char *>;
template class ACE_Hash_Map_Iterator_Base_Ex<char *, Load_Balancer::Object_Group_var, ACE_Hash<char *>, ACE_Equal_To<char *>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Iterator<char *, char *, ACE_Null_Mutex>;
@@ -1043,6 +1044,7 @@ template class ACE_DLList_Iterator<char *>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_Memory_Pool, ACE_Thread_Mutex> >
#pragma instantaite ACE_Malloc<ACE_MMAP_Memory_Pool, ACE_Thread_Mutex>
+#pragma instantaite ACE_Malloc_T<ACE_MMAP_Memory_Pool, ACE_Thread_Mutex, ACE_Control_Block>
#pragma instantiate ACE_Hash_Map_With_Allocator<char *, char *>
#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<char *, char *, ACE_Hash<char *>, ACE_Equal_To<char *>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Iterator<char *, char *, ACE_Null_Mutex>
diff --git a/TAO/examples/POA/DSI/Database_i.cpp b/TAO/examples/POA/DSI/Database_i.cpp
index e17dff6a42f..2f08898e59e 100644
--- a/TAO/examples/POA/DSI/Database_i.cpp
+++ b/TAO/examples/POA/DSI/Database_i.cpp
@@ -405,10 +405,14 @@ DatabaseImpl::Employee::operator delete (void *pointer)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
template class ACE_Malloc_Iterator<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>;
+template class ACE_Malloc_LIFO_Iterator_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
template class ACE_Singleton<DatabaseImpl::Simpler_Database_Malloc, ACE_Null_Mutex>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>
#pragma instantiate ACE_Malloc_Iterator<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>
+#pragma instantiate ACE_Malloc_LIFO_Iterator_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>
#pragma instantiate ACE_Singleton<DatabaseImpl::Simpler_Database_Malloc, ACE_Null_Mutex>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp
index c625121493f..2be2d61a2ad 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp
@@ -8,6 +8,7 @@
defined (ACE_HAS_GNU_REPO)
template class ACE_Auto_Basic_Ptr<TAO_Naming_Context>;
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> >;
template class ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>;
template class ACE_Hash_Map_Manager<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>;
@@ -24,6 +25,7 @@ template class ACE_Auto_Basic_Ptr<ACE_Hash_Map_With_Allocator<TAO_Persistent_Ind
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Naming_Context>
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> >
#pragma instantiate ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>
#pragma instantiate ACE_Hash_Map_Manager<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>
diff --git a/TAO/tao/default_resource.cpp b/TAO/tao/default_resource.cpp
index 19b3a8513ba..011cc356f13 100644
--- a/TAO/tao/default_resource.cpp
+++ b/TAO/tao/default_resource.cpp
@@ -715,6 +715,7 @@ ACE_FACTORY_DEFINE (TAO, TAO_Default_Resource_Factory)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX>;
+template class ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX, ACE_Control_Block>;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX> >;
template class ACE_Select_Reactor_Token_T<ACE_Noop_Token>;
@@ -724,6 +725,7 @@ template class ACE_Select_Reactor_T< ACE_Select_Reactor_Token_T<ACE_Noop_Token>
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX, ACE_Control_Block>
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX> >
#pragma instantiate ACE_Select_Reactor_Token_T<ACE_Noop_Token>
diff --git a/ace/Based_Pointer_T.h b/ace/Based_Pointer_T.h
index 4ff94632542..6dafb87cc6b 100644
--- a/ace/Based_Pointer_T.h
+++ b/ace/Based_Pointer_T.h
@@ -79,8 +79,8 @@ public:
ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &);
// Copy constructor.
- ACE_Based_Pointer_Basic (const void *base_addr, int overload);
- // Constructor for know base address. <overload> is only used to
+ ACE_Based_Pointer_Basic (const void *base_addr, int o);
+ // Constructor for know base address. <o> is only used to
// resolve overload ambiguity.
void operator = (CONCRETE *from);
@@ -155,8 +155,8 @@ public:
ACE_Based_Pointer (CONCRETE *initial);
// Initialize this object using the <initial> pointer.
- ACE_Based_Pointer (const void *base_addr, int overload);
- // Initialize this object with known <base_addr>. <overload> is
+ ACE_Based_Pointer (const void *base_addr, int o);
+ // Initialize this object with known <base_addr>. <o> is
// only used to resolve overload ambiguity.
ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &);
diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp
index 32f6d79a67b..f971326e10d 100644
--- a/ace/Configuration.cpp
+++ b/ace/Configuration.cpp
@@ -1762,6 +1762,8 @@ template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Threa
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex> >;
template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Thread_Mutex>;
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex>;
+template class ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL, ACE_Thread_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex, ACE_Control_Block>;
#endif /* ACE_HAS_THREADS */
template class ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId>;
template class ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId>;
@@ -1798,6 +1800,8 @@ template class ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, int>;
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex> >
#pragma instantiate ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Thread_Mutex>
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex>
+#pragma instantiate ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL, ACE_Thread_Mutex, ACE_Control_Block>
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex, ACE_Control_Block>
#endif /* ACE_HAS_THREADS */
#pragma instantiate ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId>
#pragma instantiate ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId>
diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp
index d3f1fe5a7cf..67e7370873c 100644
--- a/ace/Malloc.cpp
+++ b/ace/Malloc.cpp
@@ -24,7 +24,7 @@ ACE_Allocator *ACE_Allocator::allocator_ = 0;
int ACE_Allocator::delete_allocator_ = 0;
void
-ACE_Malloc_Header::dump (void) const
+ACE_Control_Block::ACE_Malloc_Header::dump (void) const
{
ACE_TRACE ("ACE_Malloc_Header::dump");
@@ -59,15 +59,15 @@ ACE_Control_Block::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
-ACE_Name_Node::ACE_Name_Node (void)
+ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (void)
{
ACE_TRACE ("ACE_Name_Node::ACE_Name_Node");
}
-ACE_Name_Node::ACE_Name_Node (const char *name,
- char *name_ptr,
- char *pointer,
- ACE_Name_Node *next)
+ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
+ char *name_ptr,
+ char *pointer,
+ ACE_Name_Node *next)
: name_ (name_ptr),
pointer_ (pointer),
next_ (next),
@@ -80,33 +80,33 @@ ACE_Name_Node::ACE_Name_Node (const char *name,
next->prev_ = this;
}
-ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
+ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
{
ACE_TRACE ("ACE_Name_Node::ACE_Name_Node");
ACE_ASSERT (!"not implemented!");
}
const char *
-ACE_Name_Node::name (void) const
+ACE_Control_Block::ACE_Name_Node::name (void) const
{
const char *c = this->name_;
return c;
}
void
-ACE_Name_Node::name (const char *)
+ACE_Control_Block::ACE_Name_Node::name (const char *)
{
ACE_ASSERT (!"not implemented yet");
}
-ACE_Malloc_Header::ACE_Malloc_Header (void)
+ACE_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void)
: next_block_ (0),
size_ (0)
{
}
void
-ACE_Name_Node::dump (void) const
+ACE_Control_Block::ACE_Name_Node::dump (void) const
{
ACE_TRACE ("ACE_Name_Node");
@@ -121,6 +121,106 @@ ACE_Name_Node::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+void
+ACE_PI_Control_Block::ACE_Malloc_Header::dump (void) const
+{
+ ACE_TRACE ("ACE_Malloc_Header::dump");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nnext_block = %x"), (ACE_Malloc_Header *) this->next_block_));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nsize = %d\n"), this->size_));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+}
+
+void
+ACE_PI_Control_Block::dump (void) const
+{
+ ACE_TRACE ("ACE_Control_Block::dump");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("Name Node:\n")));
+ for (ACE_Name_Node *nextn = this->name_head_;
+ nextn != 0;
+ nextn = nextn->next_)
+ nextn->dump ();
+
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("freep_ = %x"), (ACE_Malloc_Header *) this->freep_));
+ this->base_.dump ();
+
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nMalloc Header:\n")));
+ for (ACE_Malloc_Header *nexth = ((ACE_Malloc_Header *)this->freep_)->next_block_;
+ nexth != 0 && nexth != &this->base_;
+ nexth = nexth->next_block_)
+ nexth->dump ();
+
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\n")));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+}
+
+ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (void)
+{
+ ACE_TRACE ("ACE_Name_Node::ACE_Name_Node");
+}
+
+ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
+ char *name_ptr,
+ char *pointer,
+ ACE_Name_Node *next)
+ : name_ (name_ptr),
+ pointer_ (pointer),
+ next_ (next),
+ prev_ (0)
+{
+ ACE_TRACE ("ACE_Name_Node::ACE_Name_Node");
+ char *n = this->name_;
+ ACE_OS::strcpy (n, name);
+ if (next != 0)
+ next->prev_ = this;
+}
+
+ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
+{
+ ACE_TRACE ("ACE_Name_Node::ACE_Name_Node");
+ ACE_ASSERT (!"not implemented!");
+}
+
+const char *
+ACE_PI_Control_Block::ACE_Name_Node::name (void) const
+{
+ const char *c = this->name_;
+ return c;
+}
+
+void
+ACE_PI_Control_Block::ACE_Name_Node::name (const char *)
+{
+ ACE_ASSERT (!"not implemented yet");
+}
+
+ACE_PI_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void)
+ : next_block_ (0),
+ size_ (0)
+{
+}
+
+void
+ACE_PI_Control_Block::ACE_Name_Node::dump (void) const
+{
+ ACE_TRACE ("ACE_Name_Node");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT("pointer = %x"), (const char *) this->pointer_));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT("\nnext_ = %x"), (ACE_Name_Node *) this->next_));
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT("\nname_ = (%x, %s)"),
+ (const char *) this->name_,
+ (const char *) this->name_));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT("\n")));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+}
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
+
ACE_Allocator *
ACE_Allocator::instance (void)
{
@@ -270,17 +370,17 @@ template class ACE_Atomic_Op<ACE_PROCESS_MUTEX, int>;
#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Based_Pointer_Basic<ACE_Malloc_Header>;
-template class ACE_Based_Pointer_Basic<ACE_Name_Node>;
+template class ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Malloc_Header>;
+template class ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Name_Node>;
template class ACE_Based_Pointer_Basic<char>;
-template class ACE_Based_Pointer<ACE_Malloc_Header>;
-template class ACE_Based_Pointer<ACE_Name_Node>;
+template class ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Malloc_Header>;
+template class ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Name_Node>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Based_Pointer_Basic<ACE_Malloc_Header>
-#pragma instantiate ACE_Based_Pointer_Basic<ACE_Name_Node>
+#pragma instantiate ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Malloc_Header>
+#pragma instantiate ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Name_Node>
#pragma instantiate ACE_Based_Pointer_Basic<char>
-#pragma instantiate ACE_Based_Pointer<ACE_Malloc_Header>
-#pragma instantiate ACE_Based_Pointer<ACE_Name_Node>
+#pragma instantiate ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Malloc_Header>
+#pragma instantiate ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Name_Node>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
diff --git a/ace/Malloc.h b/ace/Malloc.h
index 22cb04a9ff8..7f9443790d6 100644
--- a/ace/Malloc.h
+++ b/ace/Malloc.h
@@ -84,111 +84,277 @@ struct ACE_Export ACE_Malloc_Stats
: (((ACE_MALLOC_PADDING / ACE_MALLOC_ALIGN) + 1) \
* ACE_MALLOC_ALIGN))
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
-#define ACE_MALLOC_HEADER_PTR ACE_Based_Pointer<ACE_Malloc_Header>
-#define ACE_NAME_NODE_PTR ACE_Based_Pointer<ACE_Name_Node>
-#define ACE_CHAR_PTR ACE_Based_Pointer_Basic<char>
-#else
-#define ACE_MALLOC_HEADER_PTR ACE_Malloc_Header *
-#define ACE_NAME_NODE_PTR ACE_Name_Node *
-#define ACE_CHAR_PTR char *
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
-
-class ACE_Export ACE_Malloc_Header
-{
- // = TITLE
- // This is the control block header. It's used by <ACE_Malloc>
- // to keep track of each chunk of data when it's in the free
- // list or in use.
-public:
- ACE_Malloc_Header (void);
-
- ACE_MALLOC_HEADER_PTR next_block_;
- // Points to next block if on free list.
-
- size_t size_;
- // Size of this header control block.
-
-#define ACE_MALLOC_PADDING_SIZE ((int) (ACE_MALLOC_HEADER_SIZE - \
- (sizeof (ACE_MALLOC_HEADER_PTR) + sizeof (size_t))) / (int) sizeof (long))
- long padding_[ACE_MALLOC_PADDING_SIZE < 1 ? 1 : ACE_MALLOC_PADDING_SIZE];
-
- void dump (void) const;
- // Dump the state of the object.
-
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
-private:
- ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Malloc_Header &))
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
-};
-
-class ACE_Export ACE_Name_Node
+class ACE_Export ACE_Control_Block
{
// = TITLE
- // This class supports "named memory regions" within <ACE_Malloc>.
+ // This information is stored in memory allocated by the <Memory_Pool>.
//
// = DESCRIPTION
- // Internally, the named memory regions are stored as a
- // doubly-linked list within the <Memory_Pool>. This makes
- // it easy to iterate over the items in the list in both FIFO
- // and LIFO order.
+ // This class defines the "old" control block class for use in
+ // ACE_Malloc_T. This control block implementation is
+ // considerable more efficient than the "position independent"
+ // one below (ACE_PI_Control_Block) but if you are going to use
+ // it to construct a ACE_Malloc_T and access the memory from
+ // several different processes, you must "map" the underlying
+ // memory pool to the same address.
public:
- // = Initialization methods.
- ACE_Name_Node (const char *name,
- char *name_ptr,
- char *pointer,
- ACE_Name_Node *head);
- // Constructor.
- ACE_Name_Node (const ACE_Name_Node &);
- // Copy constructor.
+ class ACE_Export ACE_Malloc_Header
+ {
+ // = TITLE
+ // This is the control block header. It's used by <ACE_Malloc>
+ // to keep track of each chunk of data when it's in the free
+ // list or in use.
+ public:
+ ACE_Malloc_Header (void);
- ACE_Name_Node (void);
- // Constructor.
+ ACE_Malloc_Header *next_block_;
+ // Points to next block if on free list.
- ~ACE_Name_Node (void);
- // Constructor.
+ static void init_ptr (ACE_Malloc_Header **ptr,
+ ACE_Malloc_Header *init,
+ void *base_addr);
+ // Initialize a malloc header pointer.
- const char *name (void) const;
- // Return a pointer to the name of this node.
+ size_t size_;
+ // Size of this header control block.
- void name (const char *);
- // Assign a name;
+#if defined (ACE_MALLOC_PADDING_SIZE) && (ACE_MALLOC_PADDING_SIZE == 0)
+ // No padding required.
+#else
+# if !defined (ACE_MALLOC_PADDING_SIZE)
+# define ACE_MALLOC_PADDING_SIZE ((int) (ACE_MALLOC_HEADER_SIZE - \
+ (sizeof (ACE_Malloc_Header*) + sizeof (size_t)))\
+ / (int) sizeof (long))
+# endif /* !ACE_MALLOC_PADDING_SIZE */
+ long padding_[ACE_MALLOC_PADDING_SIZE < 1 ? 1 : ACE_MALLOC_PADDING_SIZE];
+#endif /* ACE_MALLOC_PADDING_SIZE && ACE_MALLOC_PADDING_SIZE == 0 */
+
+ void dump (void) const;
+ // Dump the state of the object.
+ };
+
+ class ACE_Export ACE_Name_Node
+ {
+ // = TITLE
+ // This class supports "named memory regions" within <ACE_Malloc>.
+ //
+ // = DESCRIPTION
+ // Internally, the named memory regions are stored as a
+ // doubly-linked list within the <Memory_Pool>. This makes
+ // it easy to iterate over the items in the list in both FIFO
+ // and LIFO order.
+ public:
+ // = Initialization methods.
+ ACE_Name_Node (const char *name,
+ char *name_ptr,
+ char *pointer,
+ ACE_Name_Node *head);
+ // Constructor.
+
+ ACE_Name_Node (const ACE_Name_Node &);
+ // Copy constructor.
+
+ ACE_Name_Node (void);
+ // Constructor.
+
+ ~ACE_Name_Node (void);
+ // Constructor.
+
+ static void init_ptr (ACE_Name_Node **ptr,
+ ACE_Name_Node *init,
+ void *base_addr);
+ // Initialize a name node pointer.
+
+ const char *name (void) const;
+ // Return a pointer to the name of this node.
+
+ void name (const char *);
+ // Assign a name;
+
+ char *name_;
+ // Name of the Node.
+
+ char *pointer_;
+ // Pointer to the contents.
+
+ ACE_Name_Node *next_;
+ // Pointer to the next node in the doubly-linked list.
+
+ ACE_Name_Node *prev_;
+ // Pointer to the previous node in the doubly-linked list.
+
+ void dump (void) const;
+ // Dump the state of the object.
+ };
+
+
+ ACE_Name_Node *name_head_;
+ // Head of the linked list of Name Nodes.
- ACE_CHAR_PTR name_;
- // Name of the Node.
+ ACE_Malloc_Header *freep_;
+ // Current head of the freelist.
- ACE_CHAR_PTR pointer_;
- // Pointer to the contents.
+ char lock_name_[MAXNAMELEN];
+ // Name of lock thats ensures mutual exclusion.
- ACE_NAME_NODE_PTR next_;
- // Pointer to the next node in the doubly-linked list.
+#if defined (ACE_HAS_MALLOC_STATS)
+ // Keep statistics about ACE_Malloc state and performance.
+ ACE_Malloc_Stats malloc_stats_;
+#define ACE_CONTROL_BLOCK_SIZE ((int)(sizeof (ACE_Name_Node*) \
+ + sizeof (ACE_Malloc_Header*) \
+ + MAXNAMELEN \
+ + sizeof (ACE_Malloc_Stats)))
+#else
+#define ACE_CONTROL_BLOCK_SIZE ((int)(sizeof (ACE_Name_Node*) \
+ + sizeof (ACE_Malloc_Header*) \
+ + MAXNAMELEN))
+#endif /* ACE_HAS_MALLOC_STATS */
+
+// Notice the casting to int for <sizeof> otherwise unsigned int
+// arithmetic is used and some awful things may happen.
+#if defined (ACE_CONTROL_BLOCK_ALIGN_LONGS) && (ACE_CONTROL_BLOCK_ALIGN_LONGS == 0)
+ // No padding required in control block.
+#else
+# if !defined (ACE_CONTROL_BLOCK_ALIGN_LONGS)
+# define ACE_CONTROL_BLOCK_ALIGN_LONGS \
+ ((ACE_CONTROL_BLOCK_SIZE % ACE_MALLOC_ALIGN != 0 \
+ ? ACE_MALLOC_ALIGN - (ACE_CONTROL_BLOCK_SIZE % ACE_MALLOC_ALIGN) \
+ : ACE_MALLOC_ALIGN) / int (sizeof (long)))
+# endif /* !ACE_CONTROL_BLOCK_ALIGN_LONGS */
+ long align_[ACE_CONTROL_BLOCK_ALIGN_LONGS < 1 ? 1 : ACE_CONTROL_BLOCK_ALIGN_LONGS];
+ // Force alignment.
+#endif /* ACE_CONTROL_BLOCK_ALIGN_LONGS && ACE_CONTROL_BLOCK_ALIGN_LONGS == 0 */
- ACE_NAME_NODE_PTR prev_;
- // Pointer to the previous node in the doubly-linked list.
+ ACE_Malloc_Header base_;
+ // Dummy node used to anchor the freelist. This needs to come last...
void dump (void) const;
// Dump the state of the object.
+};
#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
-private:
- ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Name_Node &))
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
-};
-class ACE_Export ACE_Control_Block
+// prepare for position independent malloc
+class ACE_Export ACE_PI_Control_Block
{
// = TITLE
// This information is stored in memory allocated by the <Memory_Pool>.
//
// = DESCRIPTION
- // This class should be local to class ACE_Malloc, but some older
- // C++ compilers don't like nested classes in templates...
+ // This class implements the control block structure that can be
+ // used in a "position indepent" fashion, i.e., you don't need to
+ // "map" the underlying memory pool to the same address in
+ // processes sharing the memory. The tradoff of this flexibility
+ // is more expensive malloc/free operations.
public:
- ACE_NAME_NODE_PTR name_head_;
+ class ACE_Malloc_Header;
+ class ACE_Name_Node;
+
+ typedef ACE_Based_Pointer<ACE_Malloc_Header> MALLOC_HEADER_PTR;
+ typedef ACE_Based_Pointer<ACE_Name_Node> NAME_NODE_PTR;
+ typedef ACE_Based_Pointer_Basic<char> CHAR_PTR;
+
+ class ACE_Export ACE_Malloc_Header
+ {
+ // = TITLE
+ // This is the control block header. It's used by <ACE_Malloc>
+ // to keep track of each chunk of data when it's in the free
+ // list or in use.
+ public:
+ ACE_Malloc_Header (void);
+
+ MALLOC_HEADER_PTR next_block_;
+ // Points to next block if on free list.
+
+ static void init_ptr (MALLOC_HEADER_PTR *ptr,
+ ACE_Malloc_Header *init,
+ void *base_addr);
+ // Initialize a malloc header pointer.
+
+ size_t size_;
+ // Size of this header control block.
+
+#if defined (ACE_PI_MALLOC_PADDING_SIZE) && (ACE_PI_MALLOC_PADDING_SIZE == 0)
+ // No padding required for PI_Malloc_Header.
+#else
+# if !defined (ACE_PI_MALLOC_PADDING_SIZE)
+# define ACE_PI_MALLOC_PADDING_SIZE ((int) (ACE_MALLOC_HEADER_SIZE - \
+ (sizeof (MALLOC_HEADER_PTR) + sizeof (size_t)))\
+ / (int) sizeof (long))
+# endif /* !ACE_PI_MALLOC_PADDING_SIZE */
+ long padding_[ACE_PI_MALLOC_PADDING_SIZE < 1 ? 1 : ACE_PI_MALLOC_PADDING_SIZE];
+#endif /* ACE_PI_MALLOC_PADDING_SIZE && ACE_PI_MALLOC_PADDING_SIZE == 0 */
+
+ void dump (void) const;
+ // Dump the state of the object.
+
+ private:
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Malloc_Header &))
+ };
+
+ class ACE_Export ACE_Name_Node
+ {
+ // = TITLE
+ // This class supports "named memory regions" within <ACE_Malloc>.
+ //
+ // = DESCRIPTION
+ // Internally, the named memory regions are stored as a
+ // doubly-linked list within the <Memory_Pool>. This makes
+ // it easy to iterate over the items in the list in both FIFO
+ // and LIFO order.
+ public:
+ // = Initialization methods.
+ ACE_Name_Node (const char *name,
+ char *name_ptr,
+ char *pointer,
+ ACE_Name_Node *head);
+ // Constructor.
+
+ ACE_Name_Node (const ACE_Name_Node &);
+ // Copy constructor.
+
+ ACE_Name_Node (void);
+ // Constructor.
+
+ ~ACE_Name_Node (void);
+ // Constructor.
+
+ static void init_ptr (NAME_NODE_PTR *ptr,
+ ACE_Name_Node *init,
+ void *base_addr);
+ // Initialize a name node pointer.
+
+ const char *name (void) const;
+ // Return a pointer to the name of this node.
+
+ void name (const char *);
+ // Assign a name;
+
+ CHAR_PTR name_;
+ // Name of the Node.
+
+ CHAR_PTR pointer_;
+ // Pointer to the contents.
+
+ NAME_NODE_PTR next_;
+ // Pointer to the next node in the doubly-linked list.
+
+ NAME_NODE_PTR prev_;
+ // Pointer to the previous node in the doubly-linked list.
+
+ void dump (void) const;
+ // Dump the state of the object.
+
+ private:
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Name_Node &))
+ };
+
+
+ NAME_NODE_PTR name_head_;
// Head of the linked list of Name Nodes.
- ACE_MALLOC_HEADER_PTR freep_;
+ MALLOC_HEADER_PTR freep_;
// Current head of the freelist.
char lock_name_[MAXNAMELEN];
@@ -197,25 +363,30 @@ public:
#if defined (ACE_HAS_MALLOC_STATS)
// Keep statistics about ACE_Malloc state and performance.
ACE_Malloc_Stats malloc_stats_;
-#define ACE_CONTROL_BLOCK_SIZE ((int)(sizeof (ACE_NAME_NODE_PTR) \
- + sizeof (ACE_MALLOC_HEADER_PTR) \
- + MAXNAMELEN \
- + sizeof (ACE_Malloc_Stats)))
+#define ACE_PI_CONTROL_BLOCK_SIZE ((int)(sizeof (NAME_NODE_PTR) \
+ + sizeof (MALLOC_HEADER_PTR) \
+ + MAXNAMELEN \
+ + sizeof (ACE_Malloc_Stats)))
#else
-#define ACE_CONTROL_BLOCK_SIZE ((int)(sizeof (ACE_NAME_NODE_PTR) \
- + sizeof (ACE_MALLOC_HEADER_PTR) \
- + MAXNAMELEN))
+#define ACE_PI_CONTROL_BLOCK_SIZE ((int)(sizeof (NAME_NODE_PTR) \
+ + sizeof (MALLOC_HEADER_PTR) \
+ + MAXNAMELEN))
#endif /* ACE_HAS_MALLOC_STATS */
+#if defined (ACE_PI_CONTROL_BLOCK_ALIGN_LONGS) && (ACE_PI_CONTROL_BLOCK_ALIGN_LONGS == 0)
+ // No padding required for PI_Control_Block.
+#else
+# if !defined (ACE_PI_CONTROL_BLOCK_ALIGN_LONGS)
// Notice the casting to int for <sizeof> otherwise unsigned int
// arithmetic is used and some awful things may happen.
-#define ACE_CONTROL_BLOCK_ALIGN_LONGS \
- ((ACE_CONTROL_BLOCK_SIZE % ACE_MALLOC_ALIGN != 0 \
- ? ACE_MALLOC_ALIGN - (ACE_CONTROL_BLOCK_SIZE % ACE_MALLOC_ALIGN) \
+# define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS \
+ ((ACE_PI_CONTROL_BLOCK_SIZE % ACE_MALLOC_ALIGN != 0 \
+ ? ACE_MALLOC_ALIGN - (ACE_PI_CONTROL_BLOCK_SIZE % ACE_MALLOC_ALIGN) \
: ACE_MALLOC_ALIGN) / int (sizeof (long)))
-
- long align_[ACE_CONTROL_BLOCK_ALIGN_LONGS < 1 ? 1 : ACE_CONTROL_BLOCK_ALIGN_LONGS];
+# endif /* !ACE_PI_CONTROL_BLOCK_ALIGN_LONGS */
+ long align_[ACE_PI_CONTROL_BLOCK_ALIGN_LONGS < 1 ? 1 : ACE_PI_CONTROL_BLOCK_ALIGN_LONGS];
// Force alignment.
+#endif /* ACE_PI_CONTROL_BLOCK_ALIGN_LONGS && ACE_PI_CONTROL_BLOCK_ALIGN_LONGS == 0 */
ACE_Malloc_Header base_;
// Dummy node used to anchor the freelist. This needs to come last...
@@ -223,11 +394,10 @@ public:
void dump (void) const;
// Dump the state of the object.
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
private:
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Control_Block &))
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
};
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
class ACE_Export ACE_New_Allocator : public ACE_Allocator
{
diff --git a/ace/Malloc.i b/ace/Malloc.i
index 32b903bcf3e..109dc73784a 100644
--- a/ace/Malloc.i
+++ b/ace/Malloc.i
@@ -2,10 +2,47 @@
// $Id$
ACE_INLINE
-ACE_Name_Node::~ACE_Name_Node (void)
+ACE_Control_Block::ACE_Name_Node::~ACE_Name_Node (void)
{
}
+ACE_INLINE void
+ACE_Control_Block::ACE_Malloc_Header::init_ptr
+ (ACE_Malloc_Header **ptr, ACE_Malloc_Header *init, void *)
+{
+ *ptr = init;
+}
+
+ACE_INLINE void
+ACE_Control_Block::ACE_Name_Node::init_ptr
+ (ACE_Name_Node **ptr, ACE_Name_Node *init, void *)
+{
+ *ptr = init;
+}
+
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+ACE_INLINE
+ACE_PI_Control_Block::ACE_Name_Node::~ACE_Name_Node (void)
+{
+}
+
+ACE_INLINE void
+ACE_PI_Control_Block::ACE_Malloc_Header::init_ptr
+ (MALLOC_HEADER_PTR *ptr, ACE_Malloc_Header *init, void *base_addr)
+{
+ new ((void *) ptr) MALLOC_HEADER_PTR (base_addr, 0);
+ *ptr = init;
+}
+
+ACE_INLINE void
+ACE_PI_Control_Block::ACE_Name_Node::init_ptr
+ (NAME_NODE_PTR *ptr, ACE_Name_Node *init, void *base_addr)
+{
+ new ((void *) ptr) NAME_NODE_PTR (base_addr, 0);
+ *ptr = init;
+}
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
+
ACE_INLINE void *
ACE_New_Allocator::malloc (size_t nbytes)
{
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index f177568f68f..8c6733ed215 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -42,7 +42,7 @@ ACE_Cached_Allocator<T, ACE_LOCK>::~ACE_Cached_Allocator (void)
delete [] this->pool_;
}
-ACE_ALLOC_HOOK_DEFINE (ACE_Malloc)
+ACE_ALLOC_HOOK_DEFINE (ACE_Malloc_T)
template <class MALLOC>
ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (LPCTSTR pool_name)
@@ -61,7 +61,7 @@ ACE_Allocator_Adapter<MALLOC>::~ACE_Allocator_Adapter (void)
template <class MALLOC> void
ACE_Allocator_Adapter<MALLOC>::print_stats (void) const
{
- ACE_TRACE ("ACE_Malloc<MALLOC>::print_stats");
+ ACE_TRACE ("ACE_Malloc_T<MALLOC>::print_stats");
this->allocator_.print_stats ();
}
#endif /* ACE_HAS_MALLOC_STATS */
@@ -73,10 +73,10 @@ ACE_Allocator_Adapter<MALLOC>::dump (void) const
this->allocator_.dump ();
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> void
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump (void) const
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::dump");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->memory_pool_.dump ();
@@ -92,10 +92,10 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
#if defined (ACE_HAS_MALLOC_STATS)
-template <ACE_MEM_POOL_1, class ACE_LOCK> void
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::print_stats (void) const
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::print_stats (void) const
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::print_stats");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::print_stats");
ACE_GUARD (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_);
if (this->cb_ptr_ == 0)
@@ -104,15 +104,15 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::print_stats (void) const
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("(%P|%t) contents of freelist:\n")));
- for (ACE_Malloc_Header *currp = this->cb_ptr_->freep_->next_block_;
+ for (MALLOC_HEADER *currp = this->cb_ptr_->freep_->next_block_;
;
currp = currp->next_block_)
{
ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) ptr = %u, ACE_Malloc_Header units = %d, byte units = %d\n"),
+ ASYS_TEXT ("(%P|%t) ptr = %u, MALLOC_HEADER units = %d, byte units = %d\n"),
currp,
currp->size_,
- currp->size_ * sizeof (ACE_Malloc_Header)));
+ currp->size_ * sizeof (MALLOC_HEADER)));
if (currp == this->cb_ptr_->freep_)
break;
}
@@ -121,32 +121,32 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::print_stats (void) const
// Put <ptr> in the free list (locked version).
-template<ACE_MEM_POOL_1, class ACE_LOCK> void
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::free (void *ptr)
+template<ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::free (void *ptr)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::free");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::free");
ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
this->shared_free (ptr);
}
-// This function is called by the ACE_Malloc constructor to initialize
+// This function is called by the ACE_Malloc_T constructor to initialize
// the memory pool. The first time in it allocates room for the
// control block (as well as a chunk of memory, depending on
// rounding...). Depending on the type of <MEM_POOL> (i.e., shared
// vs. local) subsequent calls from other processes will only
// initialize the control block pointer.
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::open (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::open (void)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::open");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::open");
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
size_t rounded_bytes = 0;
int first_time = 0;
- this->cb_ptr_ = (ACE_Control_Block *)
+ this->cb_ptr_ = (ACE_CB *)
this->memory_pool_.init_acquire (sizeof *this->cb_ptr_,
rounded_bytes,
first_time);
@@ -165,46 +165,41 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::open (void)
new ((void *) &this->cb_ptr_->malloc_stats_) ACE_Malloc_Stats;
#endif /* ACE_HAS_MALLOC_STATS */
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
- // Initialize the freelist pointer to point to the dummy
- // <ACE_Malloc_Header>.
- new ((void *) &this->cb_ptr_->freep_) ACE_MALLOC_HEADER_PTR (&this->cb_ptr_->base_);
- new ((void *) &this->cb_ptr_->freep_->next_block_) ACE_MALLOC_HEADER_PTR (this->cb_ptr_->freep_.addr ());
- new ((void *) &this->cb_ptr_->name_head_) ACE_NAME_NODE_PTR;
- this->cb_ptr_->freep_->size_ = 0;
-#else
- // Initialize the freelist pointer to point to the dummy
- // <ACE_Malloc_Header>.
- this->cb_ptr_->freep_ = &this->cb_ptr_->base_;
- // initialize the name list to 0
- this->cb_ptr_->freep_->size_ = 0;
- // Initialize the dummy <ACE_Malloc_Header> to point to itself.
- this->cb_ptr_->freep_->next_block_ = this->cb_ptr_->freep_;
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
+ MALLOC_HEADER::init_ptr (&this->cb_ptr_->freep_,
+ &this->cb_ptr_->base_,
+ this->cb_ptr_);
+
+ MALLOC_HEADER::init_ptr (&this->cb_ptr_->freep_->next_block_,
+ this->cb_ptr_->freep_,
+ this->cb_ptr_);
- this->cb_ptr_->name_head_ = (ACE_Name_Node *) 0;
+ NAME_NODE::init_ptr (&this->cb_ptr_->name_head_,
+ 0,
+ this->cb_ptr_);
- if (rounded_bytes > (sizeof *this->cb_ptr_ + sizeof (ACE_Malloc_Header)))
+ this->cb_ptr_->freep_->size_ = 0;
+
+ if (rounded_bytes > (sizeof *this->cb_ptr_ + sizeof (MALLOC_HEADER)))
{
// If we've got any extra space at the end of the control
- // block, then skip past the dummy <ACE_Malloc_Header> to
+ // block, then skip past the dummy <MALLOC_HEADER> to
// point at the first free block.
- ACE_Malloc_Header *p = ((ACE_Malloc_Header *) (this->cb_ptr_->freep_)) + 1;
+ MALLOC_HEADER *p = ((MALLOC_HEADER *) (this->cb_ptr_->freep_)) + 1;
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
- new ((void *) &p->next_block_) ACE_MALLOC_HEADER_PTR;
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
+ MALLOC_HEADER::init_ptr (&p->next_block_,
+ 0,
+ this->cb_ptr_);
// Why aC++ in 64-bit mode can't grok this, I have no
// idea... but it ends up with an extra bit set which makes
// size_ really big without this hack.
#if defined (__hpux) && defined (__LP64__)
size_t hpux11_hack = (rounded_bytes - sizeof *this->cb_ptr_)
- / sizeof (ACE_Malloc_Header);
+ / sizeof (MALLOC_HEADER);
p->size_ = hpux11_hack;
#else
p->size_ = (rounded_bytes - sizeof *this->cb_ptr_)
- / sizeof (ACE_Malloc_Header);
+ / sizeof (MALLOC_HEADER);
#endif /* (__hpux) && defined (__LP64__) */
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.nchunks_);
@@ -212,7 +207,7 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::open (void)
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.ninuse_);
// Insert the newly allocated chunk of memory into the free
- // list. Add "1" to skip over the <ACE_Malloc_Header> when
+ // list. Add "1" to skip over the <MALLOC_HEADER> when
// freeing the pointer.
this->shared_free (p + 1);
}
@@ -220,65 +215,65 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::open (void)
return 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (LPCTSTR pool_name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (LPCTSTR pool_name)
: memory_pool_ (pool_name),
lock_ (pool_name == 0 ? 0 : ACE::basename (pool_name,
ACE_DIRECTORY_SEPARATOR_CHAR))
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T");
if (this->open () == -1)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc")));
+ ASYS_TEXT ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T")));
}
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (LPCTSTR pool_name,
- LPCTSTR lock_name,
- const ACE_MEM_POOL_OPTIONS *options)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const ACE_MEM_POOL_OPTIONS *options)
: memory_pool_ (pool_name, options),
lock_ (lock_name != 0 ? lock_name : ACE::basename (pool_name,
ACE_DIRECTORY_SEPARATOR_CHAR))
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T");
if (this->open () == -1)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("%p"),
- ASYS_TEXT ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc")));
+ ASYS_TEXT ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T")));
}
#if !defined (ACE_HAS_TEMPLATE_TYPEDEFS)
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (LPCTSTR pool_name,
- LPCTSTR lock_name,
- const void *options)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const void *options)
: memory_pool_ (pool_name,
(const ACE_MEM_POOL_OPTIONS *) options),
lock_ (lock_name)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T");
if (this->open () == -1)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("%p"),
- ASYS_TEXT ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc")));
+ ASYS_TEXT ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T")));
}
#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::~ACE_Malloc (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::~ACE_Malloc_T (void)
{
- ACE_TRACE ("ACE_Malloc<MEM_POOL>::~ACE_Malloc<MEM_POOL>");
+ ACE_TRACE ("ACE_Malloc_T<MEM_POOL>::~ACE_Malloc_T<MEM_POOL>");
}
-// Clean up the resources allocated by ACE_Malloc.
+// Clean up the resources allocated by ACE_Malloc_T.
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::remove (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove (void)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::remove");
- // ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) destroying ACE_Malloc\n")));
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove");
+ // ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) destroying ACE_Malloc_T\n")));
int result = 0;
#if defined (ACE_HAS_MALLOC_STATS)
@@ -299,21 +294,21 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::remove (void)
// General-purpose memory allocator. Assumes caller holds the locks.
-template <ACE_MEM_POOL_1, class ACE_LOCK> void *
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void *
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_malloc (size_t nbytes)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_malloc");
if (this->cb_ptr_ == 0)
return 0;
- // Round up request to a multiple of the ACE_Malloc_Header size.
+ // Round up request to a multiple of the MALLOC_HEADER size.
size_t nunits =
- (nbytes + sizeof (ACE_Malloc_Header) - 1) / sizeof (ACE_Malloc_Header)
- + 1; // Add one for the <ACE_Malloc_Header> itself.
+ (nbytes + sizeof (MALLOC_HEADER) - 1) / sizeof (MALLOC_HEADER)
+ + 1; // Add one for the <MALLOC_HEADER> itself.
- ACE_Malloc_Header *prevp = 0;
- ACE_Malloc_Header *currp = 0;
+ MALLOC_HEADER *prevp = 0;
+ MALLOC_HEADER *currp = 0;
ACE_SEH_TRY
{
@@ -349,12 +344,12 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.nblocks_);
currp->size_ -= nunits;
currp += currp->size_;
- this->init_malloc_header_ptr ((void *) &currp->next_block_);
+ MALLOC_HEADER::init_ptr (&currp->next_block_, 0, this->cb_ptr_);
currp->size_ = nunits;
}
this->cb_ptr_->freep_ = prevp;
- // Skip over the ACE_Malloc_Header when returning pointer.
+ // Skip over the MALLOC_HEADER when returning pointer.
return currp + 1;
}
else if (currp == this->cb_ptr_->freep_)
@@ -365,8 +360,8 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
size_t chunk_bytes = 0;
- currp = (ACE_Malloc_Header *)
- this->memory_pool_.acquire (nunits * sizeof (ACE_Malloc_Header),
+ currp = (MALLOC_HEADER *)
+ this->memory_pool_.acquire (nunits * sizeof (MALLOC_HEADER),
chunk_bytes);
if (currp != 0)
{
@@ -374,14 +369,14 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.nchunks_);
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.ninuse_);
- this->init_malloc_header_ptr ((void *) &currp->next_block_);
+ MALLOC_HEADER::init_ptr (&currp->next_block_, 0, this->cb_ptr_);
- // Compute the chunk size in ACE_Malloc_Header units.
- currp->size_ = chunk_bytes / sizeof (ACE_Malloc_Header);
+ // Compute the chunk size in MALLOC_HEADER units.
+ currp->size_ = chunk_bytes / sizeof (MALLOC_HEADER);
// Insert the newly allocated chunk of memory into the
// free list. Add "1" to skip over the
- // <ACE_Malloc_Header> when freeing the pointer since
+ // <MALLOC_HEADER> when freeing the pointer since
// the first thing <free> does is decrement by this
// amount.
this->shared_free (currp + 1);
@@ -405,10 +400,10 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
// General-purpose memory allocator.
-template <ACE_MEM_POOL_1, class ACE_LOCK> void *
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::malloc (size_t nbytes)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void *
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::malloc (size_t nbytes)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::malloc");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::malloc");
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0);
return this->shared_malloc (nbytes);
@@ -416,11 +411,11 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::malloc (size_t nbytes)
// General-purpose memory allocator.
-template <ACE_MEM_POOL_1, class ACE_LOCK> void *
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::calloc (size_t nbytes,
- char initial_value)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void *
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::calloc (size_t nbytes,
+ char initial_value)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::calloc");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::calloc");
void *ptr = this->malloc (nbytes);
if (ptr != 0)
@@ -431,18 +426,18 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::calloc (size_t nbytes,
// Put block AP in the free list (must be called with locks held!)
-template <ACE_MEM_POOL_1, class ACE_LOCK> void
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_free (void *ap)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_free (void *ap)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_free");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_free");
if (ap == 0 || this->cb_ptr_ == 0)
return;
- // Adjust AP to point to the block ACE_Malloc_Header
- ACE_Malloc_Header *blockp = ((ACE_Malloc_Header *) ap) - 1;
- ACE_Malloc_Header *currp = this->cb_ptr_->freep_;
+ // Adjust AP to point to the block MALLOC_HEADER
+ MALLOC_HEADER *blockp = ((MALLOC_HEADER *) ap) - 1;
+ MALLOC_HEADER *currp = this->cb_ptr_->freep_;
// Search until we find the location where the blocks belongs. Note
// that addresses are kept in sorted order.
@@ -451,12 +446,12 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_free (void *ap)
{
for (;
blockp <= currp
- || blockp >= (ACE_Malloc_Header *) currp->next_block_;
+ || blockp >= (MALLOC_HEADER *) currp->next_block_;
currp = currp->next_block_)
{
- if (currp >= (ACE_Malloc_Header *) currp->next_block_
+ if (currp >= (MALLOC_HEADER *) currp->next_block_
&& (blockp > currp
- || blockp < (ACE_Malloc_Header *) currp->next_block_))
+ || blockp < (MALLOC_HEADER *) currp->next_block_))
// Freed block at the start or the end of the memory pool.
break;
}
@@ -491,17 +486,17 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_free (void *ap)
// No locks held here, caller must acquire/release lock.
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_Name_Node *
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_find (const char *name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void*
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_find (const char *name)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_find");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_find");
if (this->cb_ptr_ == 0)
return 0;
ACE_SEH_TRY
{
- for (ACE_Name_Node *node = this->cb_ptr_->name_head_;
+ for (NAME_NODE *node = this->cb_ptr_->name_head_;
node != 0;
node = node->next_)
if (ACE_OS::strcmp (node->name (),
@@ -514,42 +509,44 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_find (const char *name)
return 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind (const char *name,
- void *pointer)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_bind (const char *name,
+ void *pointer)
{
if (this->cb_ptr_ == 0)
return -1;
// Combine the two allocations into one to avoid overhead...
- ACE_Name_Node *new_node = 0;
+ NAME_NODE *new_node = 0;
ACE_ALLOCATOR_RETURN (new_node,
- (ACE_Name_Node *)
- this->shared_malloc (sizeof (ACE_Name_Node) + ACE_OS::strlen (name) + 1),
+ (NAME_NODE *)
+ this->shared_malloc (sizeof (NAME_NODE) +
+ ACE_OS::strlen (name) + 1),
-1);
char *name_ptr = (char *) (new_node + 1);
// Use operator placement new to insert <new_node> at the head of
- // the linked list of <ACE_Name_Node>s.
- ACE_Name_Node *result =
- new (new_node) ACE_Name_Node (name,
- name_ptr,
- ACE_reinterpret_cast (char *,
- pointer),
- this->cb_ptr_->name_head_);
+ // the linked list of <NAME_NODE>s.
+ NAME_NODE *result =
+ new (new_node) NAME_NODE (name,
+ name_ptr,
+ ACE_reinterpret_cast (char *,
+ pointer),
+ this->cb_ptr_->name_head_);
this->cb_ptr_->name_head_ = result;
return 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::trybind (const char *name,
- void *&pointer)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::trybind (const char *name,
+ void *&pointer)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::trybind");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::trybind");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
- ACE_Name_Node *node = this->shared_find (name);
+ NAME_NODE *node = (NAME_NODE *) this->shared_find (name);
+
if (node == 0)
// Didn't find it, so insert it.
return this->shared_bind (name, pointer);
@@ -561,12 +558,12 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::trybind (const char *name,
}
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::bind (const char *name,
- void *pointer,
- int duplicates)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::bind (const char *name,
+ void *pointer,
+ int duplicates)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::bind");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::bind");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
if (duplicates == 0 && this->shared_find (name) != 0)
@@ -580,15 +577,15 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::bind (const char *name,
return this->shared_bind (name, pointer);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::find (const char *name,
- void *&pointer)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::find (const char *name,
+ void *&pointer)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::find");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::find");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
- ACE_Name_Node *node = this->shared_find (name);
+ NAME_NODE *node = (NAME_NODE *) this->shared_find (name);
if (node == 0)
return -1;
@@ -608,10 +605,10 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::find (const char *name,
// @return function returns the number of chunks of the given size
// that would fit in the currently allocated memory
-template <ACE_MEM_POOL_1, class ACE_LOCK> ssize_t
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::avail_chunks (size_t size) const
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ssize_t
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::avail_chunks (size_t size) const
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::avail_chunks");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::avail_chunks");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, -1);
if (this->cb_ptr_ == 0)
@@ -621,37 +618,37 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::avail_chunks (size_t size) const
// Avoid dividing by 0...
size = size == 0 ? 1 : size;
- for (ACE_Malloc_Header *currp = this->cb_ptr_->freep_->next_block_;
+ for (MALLOC_HEADER *currp = this->cb_ptr_->freep_->next_block_;
currp != this->cb_ptr_->freep_;
currp = currp->next_block_)
// Calculate how many will fit in this block.
- if (currp->size_ * sizeof (ACE_Malloc_Header) >= size)
- count += currp->size_ * sizeof (ACE_Malloc_Header) / size;
+ if (currp->size_ * sizeof (MALLOC_HEADER) >= size)
+ count += currp->size_ * sizeof (MALLOC_HEADER) / size;
return count;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::find (const char *name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::find (const char *name)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::find");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::find");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
return this->shared_find (name) == 0 ? -1 : 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const char *name, void *&pointer)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::unbind (const char *name, void *&pointer)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::unbind");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
if (this->cb_ptr_ == 0)
return -1;
- ACE_Name_Node *prev = 0;
+ NAME_NODE *prev = 0;
- for (ACE_Name_Node *curr = this->cb_ptr_->name_head_;
+ for (NAME_NODE *curr = this->cb_ptr_->name_head_;
curr != 0;
curr = curr->next_)
{
@@ -676,18 +673,18 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const char *name, void *&pointer)
return -1;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const char *name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::unbind (const char *name)
{
- ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind");
+ ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::unbind");
void *temp = 0;
return this->unbind (name, temp);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> void
-ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void
+ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump (void) const
{
- ACE_TRACE ("ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::dump");
+ ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->curr_->dump ();
@@ -697,35 +694,35 @@ ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_LIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
- const char *name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_LIFO_Iterator_T (ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc,
+ const char *name)
: malloc_ (malloc),
curr_ (0),
guard_ (malloc_.lock_),
name_ (name != 0 ? ACE_OS::strdup (name) : 0)
{
- ACE_TRACE ("ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_LIFO_Iterator");
+ ACE_TRACE ("ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_LIFO_Iterator");
// Cheap trick to make code simple.
// @@ Doug, this looks like trouble...
- ACE_Name_Node temp;
+ NAME_NODE temp;
this->curr_ = &temp;
this->curr_->next_ = malloc_.cb_ptr_->name_head_;
this->advance ();
}
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::~ACE_Malloc_LIFO_Iterator (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::~ACE_Malloc_LIFO_Iterator_T (void)
{
ACE_OS::free ((void *) this->name_);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry,
- const char *&name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next (void *&next_entry,
+ const char *&name)
{
- ACE_TRACE ("ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next");
+ ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next");
if (this->curr_ != 0)
{
@@ -737,10 +734,10 @@ ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry,
return 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next (void *&next_entry)
{
- ACE_TRACE ("ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next");
+ ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next");
if (this->curr_ != 0)
{
@@ -751,18 +748,18 @@ ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry)
return 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::done (void) const
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::done (void) const
{
- ACE_TRACE ("ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::done");
+ ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::done");
return this->curr_ == 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::advance (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::advance (void)
{
- ACE_TRACE ("ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::advance");
+ ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::advance");
this->curr_ = this->curr_->next_;
@@ -777,10 +774,10 @@ ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::advance (void)
return this->curr_ != 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> void
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> void
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump (void) const
{
- ACE_TRACE ("ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::dump");
+ ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->curr_->dump ();
@@ -790,18 +787,18 @@ ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_FIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
- const char *name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_FIFO_Iterator_T (ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc,
+ const char *name)
: malloc_ (malloc),
curr_ (0),
guard_ (malloc_.lock_),
name_ (name != 0 ? ACE_OS::strdup (name) : 0)
{
- ACE_TRACE ("ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_FIFO_Iterator");
+ ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_FIFO_Iterator");
// Cheap trick to make code simple.
// @@ Doug, this looks like trouble...
- ACE_Name_Node temp;
+ NAME_NODE temp;
this->curr_ = &temp;
this->curr_->next_ = malloc_.cb_ptr_->name_head_;
this->curr_->prev_ = 0;
@@ -810,17 +807,17 @@ ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_FIFO_Iterator (AC
this->start ();
}
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::~ACE_Malloc_FIFO_Iterator (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::~ACE_Malloc_FIFO_Iterator_T (void)
{
ACE_OS::free ((void *) this->name_);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry,
- const char *&name)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next (void *&next_entry,
+ const char *&name)
{
- ACE_TRACE ("ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next");
+ ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next");
if (this->curr_ != 0)
{
@@ -832,10 +829,10 @@ ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry,
return 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next (void *&next_entry)
{
- ACE_TRACE ("ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next");
+ ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next");
if (this->curr_ != 0)
{
@@ -846,18 +843,18 @@ ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::next (void *&next_entry)
return 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::done (void) const
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::done (void) const
{
- ACE_TRACE ("ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::done");
+ ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::done");
return this->curr_ == 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::advance (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::advance (void)
{
- ACE_TRACE ("ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::advance");
+ ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::advance");
this->curr_ = this->curr_->prev_;
@@ -872,11 +869,11 @@ ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::advance (void)
return this->curr_ != 0;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::start (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> int
+ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::start (void)
{
this->curr_ = this->curr_->next_;
- ACE_Name_Node *prev = 0;
+ NAME_NODE *prev = 0;
// Locate the element that was inserted first.
// @@ We could optimize this by making the list a circular list or
diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h
index 3bcfe954466..8476f81cdf6 100644
--- a/ace/Malloc_T.h
+++ b/ace/Malloc_T.h
@@ -237,18 +237,18 @@ private:
};
// Forward declaration.
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-class ACE_Malloc_LIFO_Iterator;
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+class ACE_Malloc_LIFO_Iterator_T;
// Ensure backwards compatibility...
#define ACE_Malloc_Iterator ACE_Malloc_LIFO_Iterator
// Forward declaration.
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-class ACE_Malloc_FIFO_Iterator;
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+class ACE_Malloc_FIFO_Iterator_T;
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-class ACE_Malloc
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+class ACE_Malloc_T
{
// = TITLE
// Define a C++ class that uses parameterized types to provide
@@ -260,21 +260,23 @@ class ACE_Malloc
// MEMORY_POOL strategies and different types of ACE_LOCK
// strategies.
public:
- friend class ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>;
- friend class ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>;
+ friend class ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>;
+ friend class ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>;
typedef ACE_MEM_POOL MEMORY_POOL;
typedef ACE_MEM_POOL_OPTIONS MEMORY_POOL_OPTIONS;
+ typedef ACE_TYPENAME ACE_CB::ACE_Name_Node NAME_NODE;
+ typedef ACE_TYPENAME ACE_CB::ACE_Malloc_Header MALLOC_HEADER;
// = Initialization and termination methods.
- ACE_Malloc (LPCTSTR pool_name = 0);
+ ACE_Malloc_T (LPCTSTR pool_name = 0);
// Initialize ACE_Malloc. This constructor passes <pool_name> to
// initialize the memory pool, and uses <ACE::basename> to
// automatically extract out the name used for the underlying lock
// name (if necessary).
- ACE_Malloc (LPCTSTR pool_name,
- LPCTSTR lock_name,
- const ACE_MEM_POOL_OPTIONS *options = 0);
+ ACE_Malloc_T (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const ACE_MEM_POOL_OPTIONS *options = 0);
// Initialize ACE_Malloc. This constructor passes <pool_name> to
// initialize the memory pool, and uses <lock_name> to automatically
// extract out the name used for the underlying lock name (if
@@ -282,14 +284,14 @@ public:
// initialize the underlying memory pool.
#if !defined (ACE_HAS_TEMPLATE_TYPEDEFS)
- ACE_Malloc (LPCTSTR pool_name,
- LPCTSTR lock_name,
- const void *options = 0);
+ ACE_Malloc_T (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const void *options = 0);
// This is necessary to work around template bugs with certain C++
// compilers.
#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
- ~ACE_Malloc (void);
+ ~ACE_Malloc_T (void);
// Destructor
int remove (void);
@@ -398,19 +400,16 @@ private:
int open (void);
// Initialize the Malloc pool.
- void init_malloc_header_ptr (void *);
- // Helper function to initialize a null malloc header (position
- // independent) pointer.
-
int shared_bind (const char *name,
void *pointer);
// Associate <name> with <pointer>. Assumes that locks are held by
// callers.
- ACE_Name_Node *shared_find (const char *name);
+ void *shared_find (const char *name);
// Try to locate <name>. If found, return the associated
// <ACE_Name_Node>, else returns 0 if can't find the <name>.
- // Assumes that locks are held by callers.
+ // Assumes that locks are held by callers. Remember to cast the
+ // return value to ACE_CB::ACE_Name_Node*.
void *shared_malloc (size_t nbytes);
// Allocate memory. Assumes that locks are held by callers.
@@ -418,7 +417,7 @@ private:
void shared_free (void *ptr);
// Deallocate memory. Assumes that locks are held by callers.
- ACE_Control_Block *cb_ptr_;
+ ACE_CB *cb_ptr_;
// Pointer to the control block that is stored in memory controlled
// by <MEMORY_POOL>.
@@ -429,8 +428,8 @@ private:
// Lock that ensures mutual exclusion for the <MEMORY_POOL>.
};
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-class ACE_Malloc_LIFO_Iterator
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+class ACE_Malloc_LIFO_Iterator_T
{
// = TITLE
// LIFO iterator for names stored in Malloc'd memory.
@@ -438,13 +437,16 @@ class ACE_Malloc_LIFO_Iterator
// = DESCRIPTION
// Does not support deletions while iteration is occurring.
public:
+ typedef ACE_TYPENAME ACE_CB::ACE_Name_Node NAME_NODE;
+ typedef ACE_TYPENAME ACE_CB::ACE_Malloc_Header MALLOC_HEADER;
+
// = Initialization method.
- ACE_Malloc_LIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
- const char *name = 0);
+ ACE_Malloc_LIFO_Iterator_T (ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc,
+ const char *name = 0);
// if <name> = 0 it will iterate through everything else only
// through those entries whose <name> match.
- ~ACE_Malloc_LIFO_Iterator (void);
+ ~ACE_Malloc_LIFO_Iterator_T (void);
// = Iteration methods.
@@ -472,10 +474,10 @@ public:
// Declare the dynamic allocation hooks.
private:
- ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc_;
+ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc_;
// Malloc we are iterating over.
- ACE_Name_Node *curr_;
+ NAME_NODE *curr_;
// Keeps track of how far we've advanced...
ACE_Read_Guard<ACE_LOCK> guard_;
@@ -485,8 +487,8 @@ private:
// Name that we are searching for.
};
-template <ACE_MEM_POOL_1, class ACE_LOCK>
-class ACE_Malloc_FIFO_Iterator
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
+class ACE_Malloc_FIFO_Iterator_T
{
// = TITLE
// FIFO iterator for names stored in Malloc'd memory.
@@ -494,13 +496,16 @@ class ACE_Malloc_FIFO_Iterator
// = DESCRIPTION
// Does not support deletions while iteration is occurring.
public:
+ typedef ACE_TYPENAME ACE_CB::ACE_Name_Node NAME_NODE;
+ typedef ACE_TYPENAME ACE_CB::ACE_Malloc_Header MALLOC_HEADER;
+
// = Initialization method.
- ACE_Malloc_FIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
- const char *name = 0);
+ ACE_Malloc_FIFO_Iterator_T (ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc,
+ const char *name = 0);
// if <name> = 0 it will iterate through everything else only
// through those entries whose <name> match.
- ~ACE_Malloc_FIFO_Iterator (void);
+ ~ACE_Malloc_FIFO_Iterator_T (void);
// = Iteration methods.
@@ -532,10 +537,10 @@ public:
// Declare the dynamic allocation hooks.
private:
- ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc_;
+ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc_;
// Malloc we are iterating over.
- ACE_Name_Node *curr_;
+ NAME_NODE *curr_;
// Keeps track of how far we've advanced...
ACE_Read_Guard<ACE_LOCK> guard_;
@@ -545,6 +550,57 @@ private:
// Name that we are searching for.
};
+template <ACE_MEM_POOL_1, class ACE_LOCK>
+class ACE_Malloc : public ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block>
+{
+public:
+ // = Initialization and termination methods.
+ ACE_Malloc (LPCTSTR pool_name = 0);
+ // Initialize ACE_Malloc. This constructor passes <pool_name> to
+ // initialize the memory pool, and uses <ACE::basename> to
+ // automatically extract out the name used for the underlying lock
+ // name (if necessary).
+
+ ACE_Malloc (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const ACE_MEM_POOL_OPTIONS *options = 0);
+ // Initialize ACE_Malloc. This constructor passes <pool_name> to
+ // initialize the memory pool, and uses <lock_name> to automatically
+ // extract out the name used for the underlying lock name (if
+ // necessary). In addition, <options> is passed through to
+ // initialize the underlying memory pool.
+
+#if !defined (ACE_HAS_TEMPLATE_TYPEDEFS)
+ ACE_Malloc (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const void *options = 0);
+ // This is necessary to work around template bugs with certain C++
+ // compilers.
+#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
+};
+
+template <ACE_MEM_POOL_1, class ACE_LOCK>
+class ACE_Malloc_LIFO_Iterator : public ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block>
+{
+public:
+ // = Initialization method.
+ ACE_Malloc_LIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
+ const char *name = 0);
+ // if <name> = 0 it will iterate through everything else only
+ // through those entries whose <name> match.
+};
+
+template <ACE_MEM_POOL_1, class ACE_LOCK>
+class ACE_Malloc_FIFO_Iterator : public ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block>
+{
+public:
+ // = Initialization method.
+ ACE_Malloc_FIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
+ const char *name = 0);
+ // if <name> = 0 it will iterate through everything else only
+ // through those entries whose <name> match.
+};
+
#if defined (__ACE_INLINE__)
#include "ace/Malloc_T.i"
#endif /* __ACE_INLINE__ */
diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i
index 8f13b7dc39d..0d904b803fd 100644
--- a/ace/Malloc_T.i
+++ b/ace/Malloc_T.i
@@ -152,55 +152,96 @@ ACE_Allocator_Adapter<MALLOC>::protect (void *addr, size_t len, int flags)
return this->allocator_.protect (addr, len, flags);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE ACE_MEM_POOL &
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::memory_pool (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE ACE_MEM_POOL &
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::memory_pool (void)
{
- ACE_TRACE ("ACE_Malloc<MEMORY_POOL, ACE_LOCK>::memory_pool");
+ ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::memory_pool");
return this->memory_pool_;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::sync (ssize_t len,
- int flags)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::sync (ssize_t len,
+ int flags)
{
- ACE_TRACE ("ACE_Malloc<MEMORY_POOL, ACE_LOCK>::sync");
+ ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::sync");
return this->memory_pool_.sync (len, flags);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::sync (void *addr,
- size_t len,
- int flags)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::sync (void *addr,
+ size_t len,
+ int flags)
{
- ACE_TRACE ("ACE_Malloc<MEMORY_POOL, ACE_LOCK>::sync");
+ ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::sync");
return this->memory_pool_.sync (addr, len, flags);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::protect (ssize_t len,
- int flags)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::protect (ssize_t len,
+ int flags)
{
- ACE_TRACE ("ACE_Malloc<MEMORY_POOL, ACE_LOCK>::protect");
+ ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::protect");
return this->memory_pool_.protect (len, flags);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE int
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::protect (void *addr,
- size_t len,
- int flags)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::protect (void *addr,
+ size_t len,
+ int flags)
{
- ACE_TRACE ("ACE_Malloc<MEMORY_POOL, ACE_LOCK>::protect");
+ ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::protect");
return this->memory_pool_.protect (addr, len, flags);
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE ACE_LOCK &
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::mutex (void)
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE ACE_LOCK &
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::mutex (void)
{
return this->lock_;
}
-template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE void
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::init_malloc_header_ptr (void* ptr)
+template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
+ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (LPCTSTR pool_name)
+ : ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (pool_name)
+{
+}
+
+template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
+ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const ACE_MEM_POOL_OPTIONS *options)
+ : ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (pool_name, lock_name, options)
+{
+}
+
+#if !defined (ACE_HAS_TEMPLATE_TYPEDEFS)
+template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
+ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (LPCTSTR pool_name,
+ LPCTSTR lock_name,
+ const void *options)
+ : ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (pool_name, lock_name, options)
+{
+}
+#endif /* !ACE_HAS_TEMPLATE_TYPEDEFS */
+
+template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
+ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_LIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
+ const char *name)
+ : ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (malloc, name)
+{
+}
+
+template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
+ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_FIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
+ const char *name)
+ : ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (malloc, name)
+{
+}
+
+
+
+#if 0
+template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE void
+ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::init_malloc_header_ptr (void* ptr)
{
#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
new (ptr) ACE_MALLOC_HEADER_PTR (this->cb_ptr_, 0);
@@ -208,3 +249,4 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::init_malloc_header_ptr (void* ptr)
ACE_UNUSED_ARG (ptr);
#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
}
+#endif
diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp
index d2d2e8f22eb..2328c464612 100644
--- a/ace/Naming_Context.cpp
+++ b/ace/Naming_Context.cpp
@@ -650,6 +650,8 @@ template class ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>
template class ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>;
template class ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>;
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>;
+template class ACE_Malloc_T<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >;
template class ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > >;
@@ -659,6 +661,8 @@ template class ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_LITE_M
#pragma instantiate ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>
#pragma instantiate ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>
+#pragma instantiate ACE_Malloc_T<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >
#pragma instantiate ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > >
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp
index ef074cc47de..d27e5b856a3 100644
--- a/ace/Service_Config.cpp
+++ b/ace/Service_Config.cpp
@@ -866,6 +866,7 @@ template class ACE_Unbounded_Queue_Iterator<ACE_CString>;
template class ACE_Unbounded_Set<ACE_CString>;
template class ACE_Unbounded_Set_Iterator<ACE_CString>;
template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>;
+template class ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >;
template class auto_ptr<ACE_Obstack>;
template class ACE_Auto_Basic_Ptr<ACE_Obstack>;
@@ -879,6 +880,7 @@ template class ACE_Auto_Basic_Ptr<ACE_Obstack>;
#pragma instantiate ACE_Unbounded_Set<ACE_CString>
#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_CString>
#pragma instantiate ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>
+#pragma instantiate ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >
#pragma instantiate auto_ptr<ACE_Obstack>
#pragma instantiate ACE_Auto_Basic_Ptr<ACE_Obstack>
diff --git a/ace/System_Time.cpp b/ace/System_Time.cpp
index 833086650cd..866050074e1 100644
--- a/ace/System_Time.cpp
+++ b/ace/System_Time.cpp
@@ -101,9 +101,11 @@ ACE_System_Time::sync_local_system_time (ACE_System_Time::Sync_Mode)
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> >;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> >
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/ace/Template_Instantiations.cpp b/ace/Template_Instantiations.cpp
index c21501d45e3..c7425fa0eb5 100644
--- a/ace/Template_Instantiations.cpp
+++ b/ace/Template_Instantiations.cpp
@@ -203,11 +203,16 @@ template class ACE_Fixed_Set_Iterator<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLE
template class ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>;
template class ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>;
-template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>;
+template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>;
template class ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>;
template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>;
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>;
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>;
+template class ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_T<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_T<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >;
diff --git a/docs/tutorials/021/client.cpp b/docs/tutorials/021/client.cpp
index 4ec10f7b4f8..544f72b49fe 100644
--- a/docs/tutorials/021/client.cpp
+++ b/docs/tutorials/021/client.cpp
@@ -108,11 +108,13 @@ main (int, char *[])
*/
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>;
template class ACE_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Write_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Read_Guard<ACE_SV_Semaphore_Simple>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>
#pragma instantiate ACE_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Write_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Read_Guard<ACE_SV_Semaphore_Simple>
diff --git a/docs/tutorials/021/server.cpp b/docs/tutorials/021/server.cpp
index a89fba799b5..78e9e161171 100644
--- a/docs/tutorials/021/server.cpp
+++ b/docs/tutorials/021/server.cpp
@@ -143,11 +143,13 @@ main (int, char *[])
*/
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>;
template class ACE_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Write_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Read_Guard<ACE_SV_Semaphore_Simple>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>
#pragma instantiate ACE_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Write_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Read_Guard<ACE_SV_Semaphore_Simple>
diff --git a/examples/Reactor/Misc/demuxing.dsp b/examples/Reactor/Misc/demuxing.dsp
index d8efef69f63..1e56284a4d4 100644
--- a/examples/Reactor/Misc/demuxing.dsp
+++ b/examples/Reactor/Misc/demuxing.dsp
@@ -1,101 +1,101 @@
-# Microsoft Developer Studio Project File - Name="demuxing" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=demuxing - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "demuxing.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "demuxing.mak" CFG="demuxing - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "demuxing - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "demuxing - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "demuxing - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "demuxing - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "demuxing___Win32_Debug"
-# PROP BASE Intermediate_Dir "demuxing___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "demuxing - Win32 Release"
-# Name "demuxing - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\test_demuxing.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="demuxing" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=demuxing - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "demuxing.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "demuxing.mak" CFG="demuxing - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "demuxing - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "demuxing - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "demuxing - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "demuxing - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "demuxing___Win32_Debug"
+# PROP BASE Intermediate_Dir "demuxing___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "demuxing - Win32 Release"
+# Name "demuxing - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\test_demuxing.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/Shared_Malloc/Malloc.cpp b/examples/Shared_Malloc/Malloc.cpp
index 510fbe729a9..0da94c9c0a6 100644
--- a/examples/Shared_Malloc/Malloc.cpp
+++ b/examples/Shared_Malloc/Malloc.cpp
@@ -60,6 +60,7 @@ template class ACE_Allocator_Adapter<M_ALLOCATOR>;
#if !defined (ACE_LACKS_SBRK)
template class ACE_Allocator_Adapter<SB_ALLOCATOR>;
template class ACE_Malloc <ACE_SBRK_MEMORY_POOL, ACE_SYNCH_MUTEX>;
+template class ACE_Malloc_T <ACE_SBRK_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>;
#endif /* ! ACE_LACKS_SBRK */
#if !defined (ACE_LACKS_SYSV_SHMEM)
template class ACE_Allocator_Adapter<SP_ALLOCATOR>;
@@ -67,6 +68,8 @@ template class ACE_Allocator_Adapter<SP_ALLOCATOR>;
template class ACE_Allocator_Adapter<ST_ALLOCATOR>;
template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX>;
template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex>;
+template class ACE_Malloc_T <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>;
+template class ACE_Malloc_T <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block>;
template class ACE_Read_Guard<ACE_Process_Mutex>;
template class ACE_Write_Guard<ACE_Process_Mutex>;
#if !defined (ACE_HAS_THREADS)
@@ -76,9 +79,12 @@ template class ACE_Write_Guard<ACE_SYNCH_MUTEX>;
#if defined (ACE_LACKS_SYSV_SHMEM)
template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>;
+template class ACE_Malloc_T <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>;
#else
template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex>;
template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX>;
+template class ACE_Malloc_T <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_T <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>;
#endif /* ACE_LACKS_SYSV_SHMEM */
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
@@ -87,6 +93,7 @@ template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX>;
#if !defined (ACE_LACKS_SBRK)
#pragma instantiate ACE_Allocator_Adapter<SB_ALLOCATOR>
#pragma instantiate ACE_Malloc <ACE_SBRK_MEMORY_POOL, ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Malloc_T <ACE_SBRK_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>
#endif /* ! ACE_LACKS_SYSV_SHMEM */
#if !defined (ACE_LACKS_SBRK)
#pragma instantiate ACE_Allocator_Adapter<SP_ALLOCATOR>
@@ -94,6 +101,8 @@ template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX>;
#pragma instantiate ACE_Allocator_Adapter<ST_ALLOCATOR>
#pragma instantiate ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX>
#pragma instantiate ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex>
+#pragma instantiate ACE_Malloc_T <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>
+#pragma instantiate ACE_Malloc_T <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block>
#pragma instantiate ACE_Read_Guard<ACE_Process_Mutex>
#pragma instantiate ACE_Write_Guard<ACE_Process_Mutex>
#if !defined (ACE_HAS_THREADS)
@@ -103,9 +112,12 @@ template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX>;
#if defined (ACE_LACKS_SYSV_SHMEM)
#pragma instantiate ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Malloc_T <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>
#else
#pragma instantiate ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex>
#pragma instantiate ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Malloc_T <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block>
+#pragma instantiate ACE_Malloc_T <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX, ACE_Control_Block>
#endif /* ACE_LACKS_SYSV_SHMEM */
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/Shared_Malloc/test_persistence.cpp b/examples/Shared_Malloc/test_persistence.cpp
index c26055c5fe5..d4ad2575b4d 100644
--- a/examples/Shared_Malloc/test_persistence.cpp
+++ b/examples/Shared_Malloc/test_persistence.cpp
@@ -313,9 +313,13 @@ main (int argc, char *argv[])
// template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>;
template class ACE_Malloc_FIFO_Iterator <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>;
template class ACE_Malloc_LIFO_Iterator <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>;
+template class ACE_Malloc_FIFO_Iterator_T <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
+template class ACE_Malloc_LIFO_Iterator_T <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
// The following instantiation is in ace/System_Time.cpp:
// #pragma instantiate ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>
#pragma instantiate ACE_Malloc_FIFO_Iterator <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>
#pragma instantiate ACE_Malloc_LIFO_Iterator <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>
+#pragma instantiate ACE_Malloc_FIFO_Iterator_T <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>
+#pragma instantiate ACE_Malloc_LIFO_Iterator_T <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp
index b98c664883b..c5e96ed0416 100644
--- a/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp
+++ b/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp
@@ -9,8 +9,8 @@
#include "Semaphore_Test.h"
ACE_Malloc<ACE_Shared_Memory_Pool, ACE_SV_Semaphore_Simple> allocator;
-ACE_SV_Semaphore_Complex *mutex = 0;
-ACE_SV_Semaphore_Complex *synch = 0;
+ACE_SV_Semaphore_Complex *mutex = 0;
+ACE_SV_Semaphore_Complex *synch = 0;
/* Pointer to memory shared by both the client and server. */
static char *shm;
@@ -72,23 +72,23 @@ main (void)
return do_child ();
default:
{
- int result = do_parent ();
+ int result = do_parent ();
- if (wait (0) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "wait"), -1);
+ if (wait (0) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "wait"), -1);
- allocator.remove ();
+ allocator.remove ();
- if (mutex->remove () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mutex.remove"), -1);
- else if (synch->remove () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "synch.remove"), -1);
- return result;
+ if (mutex->remove () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mutex.remove"), -1);
+ else if (synch->remove () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "synch.remove"), -1);
+ return result;
}
}
}
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
template class ACE_Malloc<ACE_Shared_Memory_Pool, ACE_SV_Semaphore_Simple>;
+template class ACE_Malloc_T<ACE_Shared_Memory_Pool, ACE_SV_Semaphore_Simple, ACE_Control_Block>;
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
-
diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphores_1.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphores_1.cpp
index d0b2d075da8..7f3e5fa621c 100644
--- a/examples/System_V_IPC/SV_Semaphores/Semaphores_1.cpp
+++ b/examples/System_V_IPC/SV_Semaphores/Semaphores_1.cpp
@@ -80,7 +80,7 @@ main (int, char *[])
int main (int, char *[])
{
ACE_ERROR ((LM_ERROR,
- "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
+ "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
return 0;
}
#endif /* ACE_HAS_SYSV_IPC */
@@ -90,11 +90,13 @@ int main (int, char *[])
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>;
+template class ACE_Malloc_T<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>;
template class ACE_Read_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Write_Guard<ACE_SV_Semaphore_Simple>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Malloc_T<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>
#pragma instantiate ACE_Read_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Write_Guard<ACE_SV_Semaphore_Simple>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp
index 1960dba20f0..ed3995ba7bf 100644
--- a/examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp
+++ b/examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp
@@ -111,11 +111,13 @@ int main (int, char *[])
# if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>;
+template class ACE_Malloc_T<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>;
template class ACE_Read_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Write_Guard<ACE_SV_Semaphore_Simple>;
# elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Malloc_T<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>
#pragma instantiate ACE_Read_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Write_Guard<ACE_SV_Semaphore_Simple>
# endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/tests/Malloc_Test.cpp b/tests/Malloc_Test.cpp
index 765d6347f38..15c773e1425 100644
--- a/tests/Malloc_Test.cpp
+++ b/tests/Malloc_Test.cpp
@@ -32,7 +32,11 @@ USELIB("..\ace\aced.lib");
#if !defined (__Lynx__) && (!defined (ACE_LACKS_FORK) || defined (ACE_WIN32))
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+typedef ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> MALLOC;
+#else
typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> MALLOC;
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
#define MMAP_FILENAME ACE_TEXT ("test_file")
#define MUTEX_NAME ACE_TEXT ("test_lock")
@@ -326,9 +330,16 @@ main (int argc, ASYS_TCHAR *[])
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block>;
+template class auto_ptr< ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> >;
+template class ACE_Auto_Basic_Ptr< ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> >;
+#else
template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex>;
+template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block>;
template class auto_ptr< ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> >;
template class ACE_Auto_Basic_Ptr< ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> >;
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
template class ACE_Write_Guard<ACE_Process_Mutex>;
template class ACE_Read_Guard<ACE_Process_Mutex>;
template class ACE_Based_Pointer<Test_Data>;
@@ -337,9 +348,16 @@ template class ACE_Based_Pointer_Basic<long>;
template class ACE_Based_Pointer_Basic<Long_Test>;
template class ACE_Based_Pointer<Long_Test>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block>
+#pragma instantiate auto_ptr< ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> >
+#pragma instantiate ACE_Auto_Basic_Ptr< ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> >;
+#else
#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex>
+#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block>
#pragma instantiate auto_ptr< ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> >
#pragma instantiate ACE_Auto_Basic_Ptr< ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> >;
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
#pragma instantiate ACE_Write_Guard<ACE_Process_Mutex>
#pragma instantiate ACE_Read_Guard<ACE_Process_Mutex>
#pragma instantiate ACE_Based_Pointer<Test_Data>
diff --git a/tests/SV_Shared_Memory_Test.cpp b/tests/SV_Shared_Memory_Test.cpp
index 517429a1494..afb65852a13 100644
--- a/tests/SV_Shared_Memory_Test.cpp
+++ b/tests/SV_Shared_Memory_Test.cpp
@@ -134,11 +134,13 @@ child (char *shm)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>;
+template class ACE_Malloc_T<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>;
template class ACE_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Write_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Read_Guard<ACE_SV_Semaphore_Simple>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Malloc_T<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple, ACE_Control_Block>
#pragma instantiate ACE_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Write_Guard<ACE_SV_Semaphore_Simple>
#pragma instantiate ACE_Read_Guard<ACE_SV_Semaphore_Simple>