mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
Some missing from merge.
Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
parent
ec939a5bce
commit
f4be15a7af
1895 changed files with 160408 additions and 53601 deletions
|
|
@ -1,3 +1,5 @@
|
|||
// $Id: Malloc_T.cpp 96985 2013-04-11 15:50:32Z huangh $
|
||||
|
||||
#ifndef ACE_MALLOC_T_CPP
|
||||
#define ACE_MALLOC_T_CPP
|
||||
|
||||
|
|
@ -35,13 +37,8 @@ ACE_Cached_Allocator<T, ACE_LOCK>::ACE_Cached_Allocator (size_t n_chunks)
|
|||
// previous versions of ACE
|
||||
size_t chunk_size = sizeof (T);
|
||||
chunk_size = ACE_MALLOC_ROUNDUP (chunk_size, ACE_MALLOC_ALIGN);
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_ALLOCATOR (this->pool_,
|
||||
static_cast<char*>(ACE_Allocator::instance()->malloc(sizeof(char) * n_chunks * chunk_size)));
|
||||
#else
|
||||
ACE_NEW (this->pool_,
|
||||
char[n_chunks * chunk_size]);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
for (size_t c = 0;
|
||||
c < n_chunks;
|
||||
|
|
@ -50,22 +47,16 @@ ACE_Cached_Allocator<T, ACE_LOCK>::ACE_Cached_Allocator (size_t n_chunks)
|
|||
void* placement = this->pool_ + c * chunk_size;
|
||||
this->free_list_.add (new (placement) ACE_Cached_Mem_Pool_Node<T>);
|
||||
}
|
||||
// Put into free list using placement constructor, no real memory
|
||||
// Put into free list using placement contructor, no real memory
|
||||
// allocation in the above <new>.
|
||||
}
|
||||
|
||||
template <class T, class ACE_LOCK>
|
||||
ACE_Cached_Allocator<T, ACE_LOCK>::~ACE_Cached_Allocator (void)
|
||||
{
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free (this->pool_);
|
||||
#else
|
||||
delete [] this->pool_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
}
|
||||
|
||||
ACE_ALLOC_HOOK_DEFINE_Tcc(ACE_Cached_Allocator)
|
||||
|
||||
template <class T, class ACE_LOCK> void *
|
||||
ACE_Cached_Allocator<T, ACE_LOCK>::malloc (size_t nbytes)
|
||||
{
|
||||
|
|
@ -128,7 +119,7 @@ ACE_Dynamic_Cached_Allocator<ACE_LOCK>::ACE_Dynamic_Cached_Allocator
|
|||
|
||||
this->free_list_.add (new (placement) ACE_Cached_Mem_Pool_Node<char>);
|
||||
}
|
||||
// Put into free list using placement constructor, no real memory
|
||||
// Put into free list using placement contructor, no real memory
|
||||
// allocation in the above <new>.
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +172,7 @@ ACE_Dynamic_Cached_Allocator<ACE_LOCK>::free (void * ptr)
|
|||
this->free_list_.add ((ACE_Cached_Mem_Pool_Node<char> *) ptr);
|
||||
}
|
||||
|
||||
ACE_ALLOC_HOOK_DEFINE_Tmcc (ACE_Malloc_T)
|
||||
ACE_ALLOC_HOOK_DEFINE (ACE_Malloc_T)
|
||||
|
||||
template <class MALLOC> void *
|
||||
ACE_Allocator_Adapter<MALLOC>::malloc (size_t nbytes)
|
||||
|
|
@ -366,8 +357,6 @@ ACE_Allocator_Adapter<MALLOC>::dump (void) const
|
|||
#endif /* ACE_HAS_DUMP */
|
||||
}
|
||||
|
||||
ACE_ALLOC_HOOK_DEFINE_Tt(ACE_Allocator_Adapter)
|
||||
|
||||
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
|
||||
{
|
||||
|
|
@ -516,17 +505,17 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *p
|
|||
{
|
||||
ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T");
|
||||
this->lock_ = ACE_Malloc_Lock_Adapter_T<ACE_LOCK> ()(pool_name);
|
||||
if (this->lock_ != 0)
|
||||
{
|
||||
this->delete_lock_ = true;
|
||||
if (this->lock_ == 0)
|
||||
return;
|
||||
|
||||
this->bad_flag_ = this->open ();
|
||||
this->delete_lock_ = true;
|
||||
|
||||
if (this->bad_flag_ == -1)
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T")));
|
||||
}
|
||||
this->bad_flag_ = this->open ();
|
||||
|
||||
if (this->bad_flag_ == -1)
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T")));
|
||||
}
|
||||
|
||||
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
|
||||
|
|
@ -541,16 +530,16 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *p
|
|||
// Use pool_name for lock_name if lock_name not passed.
|
||||
const ACE_TCHAR *name = lock_name ? lock_name : pool_name;
|
||||
this->lock_ = ACE_Malloc_Lock_Adapter_T<ACE_LOCK> ()(name);
|
||||
if (this->lock_ != 0)
|
||||
{
|
||||
this->delete_lock_ = true;
|
||||
if (this->lock_ == 0)
|
||||
return;
|
||||
|
||||
this->bad_flag_ = this->open ();
|
||||
if (this->bad_flag_ == -1)
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T")));
|
||||
}
|
||||
this->delete_lock_ = true;
|
||||
|
||||
this->bad_flag_ = this->open ();
|
||||
if (this->bad_flag_ == -1)
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T")));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue