diff options
author | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-12-19 13:38:49 +0000 |
---|---|---|
committer | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-12-19 13:38:49 +0000 |
commit | 114b9575f85b78e54edbf04fcc4191d685877699 (patch) | |
tree | f52ef403e37a2e1303f3e8ae692e099338dfada1 /ACE/ace/Timer_Heap_T.cpp | |
parent | 6f33ac6bb28d3068f7b739c204c0ce1308b1d91b (diff) | |
download | ATCD-114b9575f85b78e54edbf04fcc4191d685877699.tar.gz |
Mon Dec 19 13:28:16 UTC 2011 Martin Corino <mcorino@remedy.nl>
* ace/Abstract_Timer_Queue.h:
* ace/Timer_Hash_T.h:
* ace/Timer_Hash_T.cpp:
* ace/Timer_Heap_T.h:
* ace/Timer_Heap_T.cpp:
* ace/Timer_List_T.h:
* ace/Timer_List_T.cpp:
* ace/Timer_Queue_Adapters.inl:
* ace/Timer_Queue_Adapters.cpp:
* ace/Timer_Wheel_T.h:
* ace/Timer_Wheel_T.cpp:
Added close() method.
* ace/Dev_Poll_Reactor.cpp:
* ace/Proactor.cpp:
* ace/Select_Reactor_T.cpp:
* ace/WFMO_Reactor.cpp:
Implemented support for timer queue close ().
The rationale for these changes is that when using reactors with
user defined timer queues the reactor does not delete the timer queue
when being deleted itself. Without any other cleanup this created the
possibility (as encountered in TAO/tests/Bug_3837_Regression after
introduction of the TIME_POLICY changes) of outstanding timer handlers
in the queue being triggered and attempting to access the reactor after
the reactor has been destroyed.
Calling close () for timer queues the reactor does not delete solves
this potential problem.
Diffstat (limited to 'ACE/ace/Timer_Heap_T.cpp')
-rw-r--r-- | ACE/ace/Timer_Heap_T.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/ACE/ace/Timer_Heap_T.cpp b/ACE/ace/Timer_Heap_T.cpp index 47ad9994b98..411d0be5eb8 100644 --- a/ACE/ace/Timer_Heap_T.cpp +++ b/ACE/ace/Timer_Heap_T.cpp @@ -212,6 +212,29 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_Heap_T (void) delete iterator_; + this->close (); + + delete [] this->heap_; + delete [] this->timer_ids_; + + // clean up any preallocated timer nodes + if (preallocated_nodes_ != 0) + { + ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<TYPE> *> + set_iterator (this->preallocated_node_set_); + + for (ACE_Timer_Node_T<TYPE> **entry = 0; + set_iterator.next (entry) !=0; + set_iterator.advance ()) + delete [] *entry; + } +} + +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::close (void) +{ + ACE_TRACE ("ACE_Timer_Heap_T::close"); + size_t current_size = this->cur_size_; @@ -228,20 +251,8 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_Heap_T (void) this->upcall_functor ().deletion (*this, eh, act); } - delete [] this->heap_; - delete [] this->timer_ids_; - - // clean up any preallocated timer nodes - if (preallocated_nodes_ != 0) - { - ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<TYPE> *> - set_iterator (this->preallocated_node_set_); - - for (ACE_Timer_Node_T<TYPE> **entry = 0; - set_iterator.next (entry) !=0; - set_iterator.advance ()) - delete [] *entry; - } + // leave the rest to the destructor + return 0; } template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> |