diff options
author | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-09-26 17:04:36 +0000 |
---|---|---|
committer | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-09-26 17:04:36 +0000 |
commit | 1c85322806c0e0d02dcb6670c434d09f60b25612 (patch) | |
tree | 2e76ee9a0809d9afc6342cdaa0effd81b70bcab9 /ACE/ace/Timer_Hash_T.h | |
parent | f2fa0dca767976628354595cb4e1038ef1670c67 (diff) | |
download | ATCD-1c85322806c0e0d02dcb6670c434d09f60b25612.tar.gz |
ChangeLogTag: Wed Sep 26 16:51:47 UTC 2007 Vladimir Zykov <vladimir.zykov@prismtech.com>
Diffstat (limited to 'ACE/ace/Timer_Hash_T.h')
-rw-r--r-- | ACE/ace/Timer_Hash_T.h | 18 |
1 files changed, 16 insertions, 2 deletions
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 TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> class ACE_Timer_Hash_T; +template <typename TYPE> +class Hash_Token; /** * @class ACE_Timer_Hash_Upcall @@ -213,7 +215,9 @@ public: /** * Cancel all timer associated with @a type. If <dont_call> is 0 * then the <functor> 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 <dont_call> is * 0 then the <functor> 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<TYPE> *get_first (void); +protected: + /// Factory method that frees a previously allocated node. + virtual void free_node (ACE_Timer_Node_T<TYPE> *); + 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<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> &)) |