diff options
-rw-r--r-- | ACE/ChangeLog | 7 | ||||
-rw-r--r-- | ACE/ace/Timer_Hash_T.cpp | 36 | ||||
-rw-r--r-- | ACE/ace/Timer_Hash_T.h | 6 |
3 files changed, 19 insertions, 30 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index fed538bc3c2..16c5aa2ed73 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,10 @@ +Wed Sep 26 09:34:29 UTC 2007 Vladimir Zykov <vladimir.zykov@prismtech.com> + + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + Back out a fix for one of the leaks fixed before. The solution + was not perfect. + Wed Sep 26 08:37:15 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> * include/makeinclude/platform_sunos5_sunc++.GNU: diff --git a/ACE/ace/Timer_Hash_T.cpp b/ACE/ace/Timer_Hash_T.cpp index 7d3edb5a6c1..ff831c05257 100644 --- a/ACE/ace/Timer_Hash_T.cpp +++ b/ACE/ace/Timer_Hash_T.cpp @@ -20,9 +20,6 @@ ACE_RCSID(ace, template <class TYPE> struct Hash_Token { - Hash_Token (void) - {} - Hash_Token (const void *act, size_t pos, long orig_id, @@ -33,25 +30,10 @@ struct Hash_Token type_ (type) {} - ~Hash_Token (void) - {} - - Hash_Token<TYPE> *get_next (void) - { - return this->next_; - } - - void set_next (Hash_Token<TYPE> *next) - { - this->next_ = next; - } - const void *act_; size_t pos_; long orig_id_; TYPE type_; - /// Pointer to next token. - Hash_Token<TYPE> *next_; }; // Default constructor @@ -169,6 +151,8 @@ ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::deletion ( event_handler, h->act_); + delete h; + return result; } @@ -277,7 +261,6 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( #if defined (ACE_WIN64) , pointer_base_ (0) #endif /* ACE_WIN64 */ - , token_list_ () { ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); @@ -313,7 +296,6 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( #if defined (ACE_WIN64) , pointer_base_ (0) #endif /* ACE_WIN64 */ - , token_list_ () { ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); @@ -420,8 +402,8 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reschedule ( expired->get_interval ()); ACE_ASSERT (h->orig_id_ != -1); - // Since schedule above will allocated new node - // then schedule <expired> for deletion. + // Since schedule() above will allocate a new node + // then here schedule <expired> for deletion. this->free_node (expired); #if 0 @@ -465,7 +447,6 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::schedule_i ( 0, type), -1); - this->token_list_.add (h); h->orig_id_ = this->table_[position]->schedule (type, @@ -603,6 +584,8 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (long timer_id, if (act != 0) *act = h->act_; + delete h; + --this->size_; } @@ -660,6 +643,8 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, ACE_ASSERT (result == 1); ACE_UNUSED_ARG (result); + delete timer_ids[i]; + --this->size_; } @@ -836,7 +821,10 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::expire (const ACE_Time_Value this->postinvoke (info, cur_time, upcall_act); if (reclaim) - --this->size_; + { + --this->size_; + delete h; + } ++number_of_timers_expired; } diff --git a/ACE/ace/Timer_Hash_T.h b/ACE/ace/Timer_Hash_T.h index 28230ba628b..5956d3691b4 100644 --- a/ACE/ace/Timer_Hash_T.h +++ b/ACE/ace/Timer_Hash_T.h @@ -27,8 +27,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration. template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> class ACE_Timer_Hash_T; -template <typename TYPE> -class Hash_Token; /** * @class ACE_Timer_Hash_Upcall @@ -311,10 +309,6 @@ private: ptrdiff_t pointer_base_; #endif - /// Hash_Token is usually allocated in schedule but its - /// deallocation is problematic and token_list_ helps with this. - ACE_Locked_Free_List<Hash_Token<TYPE>, ACE_Null_Mutex> token_list_; - // = Don't allow these operations for now. ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_T (const ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &)) ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &)) |