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: Timer_Heap_T.cpp 97645 2014-03-07 12:01:21Z johnnyw $
|
||||
|
||||
#ifndef ACE_TIMER_HEAP_T_CPP
|
||||
#define ACE_TIMER_HEAP_T_CPP
|
||||
|
||||
|
|
@ -22,9 +24,6 @@
|
|||
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
ACE_ALLOC_HOOK_DEFINE_Tccct(ACE_Timer_Heap_Iterator_T)
|
||||
ACE_ALLOC_HOOK_DEFINE_Tccct(ACE_Timer_Heap_T)
|
||||
|
||||
// Define some simple inlined functions to clarify the code.
|
||||
inline size_t
|
||||
ACE_HEAP_PARENT (size_t X)
|
||||
|
|
@ -124,13 +123,8 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Heap_T (
|
|||
}
|
||||
|
||||
// Create the heap array.
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
this->heap_ = reinterpret_cast<ACE_Timer_Node_T<TYPE> **>
|
||||
(ACE_Allocator::instance ()->malloc (sizeof (ACE_Timer_Node_T<TYPE> *) * size));
|
||||
#else
|
||||
ACE_NEW (this->heap_,
|
||||
ACE_Timer_Node_T<TYPE> *[size]);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
ACE_NEW (this->heap_,
|
||||
ACE_Timer_Node_T<TYPE> *[size]);
|
||||
|
||||
// Create the parallel
|
||||
ACE_NEW (this->timer_ids_,
|
||||
|
|
@ -194,22 +188,12 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Heap_T (
|
|||
this->max_size_ = static_cast<size_t> (ACE_Numeric_Limits<long>::max ());
|
||||
|
||||
// Create the heap array.
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
this->heap_ = reinterpret_cast<ACE_Timer_Node_T<TYPE> **>
|
||||
(ACE_Allocator::instance ()->malloc (sizeof (ACE_Timer_Node_T<TYPE> *) * this->max_size_));
|
||||
#else
|
||||
ACE_NEW (this->heap_,
|
||||
ACE_Timer_Node_T<TYPE> *[this->max_size_]);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
// Create the parallel array.
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
this->timer_ids_ = reinterpret_cast<ssize_t *>
|
||||
(ACE_Allocator::instance ()->malloc (sizeof (ssize_t) * this->max_size_));
|
||||
#else
|
||||
ACE_NEW (this->timer_ids_,
|
||||
ssize_t[this->max_size_]);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
ACE_NEW (this->timer_ids_,
|
||||
ssize_t[this->max_size_]);
|
||||
|
||||
// Initialize the "freelist," which uses negative values to
|
||||
// distinguish freelist elements from "pointers" into the <heap_>
|
||||
|
|
@ -230,19 +214,8 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_Heap_T (void)
|
|||
|
||||
this->close ();
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
if (this->heap_)
|
||||
(ACE_Allocator::instance ()->free (this->heap_));
|
||||
#else
|
||||
delete [] this->heap_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
if (this->timer_ids_)
|
||||
(ACE_Allocator::instance ()->free (this->timer_ids_));
|
||||
#else
|
||||
delete [] this->timer_ids_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
// clean up any preallocated timer nodes
|
||||
if (preallocated_nodes_ != 0)
|
||||
|
|
@ -570,48 +543,27 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::grow_heap (void)
|
|||
// First grow the heap itself.
|
||||
ACE_Timer_Node_T<TYPE> **new_heap = 0;
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
new_heap = reinterpret_cast<ACE_Timer_Node_T<TYPE> **>
|
||||
(ACE_Allocator::instance ()->malloc (sizeof (ACE_Timer_Node_T<TYPE> *) * new_size));
|
||||
#else
|
||||
ACE_NEW (new_heap,
|
||||
ACE_Timer_Node_T<TYPE> *[new_size]);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
ACE_NEW (new_heap,
|
||||
ACE_Timer_Node_T<TYPE> *[new_size]);
|
||||
|
||||
ACE_OS::memcpy (new_heap,
|
||||
this->heap_,
|
||||
this->max_size_ * sizeof *new_heap);
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance ()->free (this->heap_);
|
||||
#else
|
||||
delete [] this->heap_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
this->heap_ = new_heap;
|
||||
|
||||
// Grow the array of timer ids.
|
||||
|
||||
ssize_t *new_timer_ids = 0;
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
new_timer_ids = reinterpret_cast<ssize_t *>
|
||||
(ACE_Allocator::instance ()->malloc (sizeof (ssize_t) * new_size));
|
||||
#else
|
||||
ACE_NEW (new_timer_ids,
|
||||
ssize_t[new_size]);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
ACE_OS::memcpy (new_timer_ids,
|
||||
this->timer_ids_,
|
||||
this->max_size_ * sizeof (ssize_t));
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
if (this->timer_ids_)
|
||||
(ACE_Allocator::instance ()->free (this->timer_ids_));
|
||||
#else
|
||||
delete [] this->timer_ids_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
delete [] timer_ids_;
|
||||
this->timer_ids_ = new_timer_ids;
|
||||
|
||||
// And add the new elements to the end of the "freelist".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue