From 1c85322806c0e0d02dcb6670c434d09f60b25612 Mon Sep 17 00:00:00 2001 From: vzykov Date: Wed, 26 Sep 2007 17:04:36 +0000 Subject: ChangeLogTag: Wed Sep 26 16:51:47 UTC 2007 Vladimir Zykov --- ACE/ace/Timer_Hash_T.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'ACE/ace/Timer_Hash_T.h') diff --git a/ACE/ace/Timer_Hash_T.h b/ACE/ace/Timer_Hash_T.h index 5956d3691b4..b919aabda9e 100644 --- a/ACE/ace/Timer_Hash_T.h +++ b/ACE/ace/Timer_Hash_T.h @@ -27,6 +27,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration. template class ACE_Timer_Hash_T; +template +class Hash_Token; /** * @class ACE_Timer_Hash_Upcall @@ -213,7 +215,9 @@ public: /** * Cancel all timer associated with @a type. If is 0 * then the will be invoked. Returns number of timers - * cancelled. + * cancelled. If any valid timer is not cancelled before destruction + * of this instance of ACE_Timer_Hash_T then user will get a memory + * leak. */ virtual int cancel (const TYPE &type, int dont_call_handle_close = 1); @@ -225,7 +229,9 @@ public: * passed in when the timer was registered. This makes it possible * to free up the memory and avoid memory leaks. If is * 0 then the will be invoked. Returns 1 if cancellation - * succeeded and 0 if the @a timer_id wasn't found. + * succeeded and 0 if the @a timer_id wasn't found. If any valid + * timer is not cancelled before destruction of this instance of + * ACE_Timer_Hash_T then user will get a memory leak. */ virtual int cancel (long timer_id, const void **act = 0, @@ -257,6 +263,10 @@ public: /// Reads the earliest node from the queue and returns it. virtual ACE_Timer_Node_T *get_first (void); +protected: + /// Factory method that frees a previously allocated node. + virtual void free_node (ACE_Timer_Node_T *); + private: /** @@ -309,6 +319,10 @@ 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, ACE_Null_Mutex> token_list_; + // = Don't allow these operations for now. ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_T (const ACE_Timer_Hash_T &)) ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_T &)) -- cgit v1.2.1