From e03e2e91bcd629d3386ea1059a1a893d976dd4e6 Mon Sep 17 00:00:00 2001 From: irfan Date: Tue, 6 May 1997 01:14:18 +0000 Subject: *** empty log message *** --- ace/Timer_List_T.cpp | 143 +++++++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 73 deletions(-) (limited to 'ace/Timer_List_T.cpp') diff --git a/ace/Timer_List_T.cpp b/ace/Timer_List_T.cpp index 4cb32a6f063..33719b8a38e 100644 --- a/ace/Timer_List_T.cpp +++ b/ace/Timer_List_T.cpp @@ -7,16 +7,16 @@ #include "ace/Timer_List_T.h" -template -ACE_Timer_List_Iterator_T::ACE_Timer_List_Iterator_T (ACE_Timer_List_T &list) +template +ACE_Timer_List_Iterator_T::ACE_Timer_List_Iterator_T (ACE_Timer_List_T &list) : timer_list_ (list) { } -template int -ACE_Timer_List_Iterator_T::next (ACE_Timer_Node_T *&node, - const ACE_Time_Value &cur_time) +template int +ACE_Timer_List_Iterator_T::next (ACE_Timer_Node_T *&node, + const ACE_Time_Value &cur_time) { if (this->timer_list_.head_ == 0 || this->timer_list_.head_->timer_value_ > cur_time) @@ -31,17 +31,17 @@ ACE_Timer_List_Iterator_T::next (ACE_Timer_Node_T ACE_ALLOC_HOOK_DEFINE(ACE_Timer_List_T) -template ACE_Timer_Queue_Iterator_T & -ACE_Timer_List_T::iter (void) +template ACE_Timer_Queue_Iterator_T & +ACE_Timer_List_T::iter (void) { return this->iterator_; } // Create an empty list. -template -ACE_Timer_List_T::ACE_Timer_List_T (FUNCTOR *upcall_functor) - : ACE_Timer_Queue_T (upcall_functor), +template +ACE_Timer_List_T::ACE_Timer_List_T (FUNCTOR *upcall_functor) + : ACE_Timer_Queue_T (upcall_functor), head_ (0), iterator_ (*this), timer_id_ (0) @@ -52,21 +52,21 @@ ACE_Timer_List_T::ACE_Timer_List_T (FUNCTOR *upcall_functor) // Checks if list is empty. -template int -ACE_Timer_List_T::is_empty (void) const +template int +ACE_Timer_List_T::is_empty (void) const { ACE_TRACE ("ACE_Timer_List::is_empty"); return this->head_ == 0; } -template ACE_Timer_Node_T * -ACE_Timer_List_T::alloc_node (void) +template ACE_Timer_Node_T * +ACE_Timer_List_T::alloc_node (void) { - return new ACE_Timer_Node_T; + return new ACE_Timer_Node_T; } -template void -ACE_Timer_List_T::free_node (ACE_Timer_Node_T *node) +template void +ACE_Timer_List_T::free_node (ACE_Timer_Node_T *node) { delete node; } @@ -74,8 +74,8 @@ ACE_Timer_List_T::free_node (ACE_Timer_Node_T *nod // Returns earliest time in a non-empty list. -template const ACE_Time_Value & -ACE_Timer_List_T::earliest_time (void) const +template const ACE_Time_Value & +ACE_Timer_List_T::earliest_time (void) const { ACE_TRACE ("ACE_Timer_List::earliest_time"); return this->head_->timer_value_; @@ -83,25 +83,25 @@ ACE_Timer_List_T::earliest_time (void) const // Remove all remaining items in the list. -template -ACE_Timer_List_T::~ACE_Timer_List_T (void) +template +ACE_Timer_List_T::~ACE_Timer_List_T (void) { ACE_TRACE ("ACE_Timer_List::~ACE_Timer_List"); - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_)); + ACE_MT (ACE_GUARD (LOCK, ace_mon, this->lock_)); - ACE_Timer_Node_T *curr = this->head_; + ACE_Timer_Node_T *curr = this->head_; while (curr != 0) { - ACE_Timer_Node_T *next = curr->next_; + ACE_Timer_Node_T *next = curr->next_; this->free_node (curr); curr = next; } } -template void -ACE_Timer_List_T::dump (void) const +template void +ACE_Timer_List_T::dump (void) const { ACE_TRACE ("ACE_Timer_List::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); @@ -114,8 +114,8 @@ ACE_Timer_List_T::dump (void) const // mutex lock held. -template void -ACE_Timer_List_T::reschedule (ACE_Timer_Node_T *expired) +template void +ACE_Timer_List_T::reschedule (ACE_Timer_Node_T *expired) { ACE_TRACE ("ACE_Timer_List::reschedule"); if (this->is_empty () @@ -126,8 +126,8 @@ ACE_Timer_List_T::reschedule (ACE_Timer_Node_T *ex } else { - ACE_Timer_Node_T *prev = this->head_; - ACE_Timer_Node_T *after = this->head_->next_; + ACE_Timer_Node_T *prev = this->head_; + ACE_Timer_Node_T *after = this->head_->next_; // Locate the proper position in the queue. @@ -147,14 +147,14 @@ ACE_Timer_List_T::reschedule (ACE_Timer_Node_T *ex // is > 0, the handler will be reinvoked periodically. -template long -ACE_Timer_List_T::schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) +template long +ACE_Timer_List_T::schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_List::schedule"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); // Increment the sequence number (it will wrap around). long timer_id = this->timer_id (); @@ -162,15 +162,15 @@ ACE_Timer_List_T::schedule (const TYPE &type, if (this->is_empty () || future_time < this->earliest_time ()) { // Place at the beginning of the list. - ACE_Timer_Node_T *temp = this->alloc_node (); + ACE_Timer_Node_T *temp = this->alloc_node (); // Use operator placement new. - this->head_ = new (temp) ACE_Timer_Node_T (type, - act, - future_time, - interval, - this->head_, - timer_id); + this->head_ = new (temp) ACE_Timer_Node_T (type, + act, + future_time, + interval, + this->head_, + timer_id); return timer_id; } @@ -178,8 +178,8 @@ ACE_Timer_List_T::schedule (const TYPE &type, // ascending order of absolute time to expire). else { - ACE_Timer_Node_T *prev = this->head_; - ACE_Timer_Node_T *after = this->head_->next_; + ACE_Timer_Node_T *prev = this->head_; + ACE_Timer_Node_T *after = this->head_->next_; while (after != 0 && future_time > after->timer_value_) { @@ -187,22 +187,22 @@ ACE_Timer_List_T::schedule (const TYPE &type, after = after->next_; } - ACE_Timer_Node_T *temp = this->alloc_node (); + ACE_Timer_Node_T *temp = this->alloc_node (); // Use operator placement new. - prev->next_ = new (temp) ACE_Timer_Node_T (type, - act, - future_time, - interval, - after, - timer_id); + prev->next_ = new (temp) ACE_Timer_Node_T (type, + act, + future_time, + interval, + after, + timer_id); return timer_id; } } -template int -ACE_Timer_List_T::timer_id (void) +template int +ACE_Timer_List_T::timer_id (void) { this->timer_id_++; @@ -217,16 +217,16 @@ ACE_Timer_List_T::timer_id (void) // from the timer queue. -template int -ACE_Timer_List_T::cancel (long timer_id, - const void **act, - int dont_call) +template int +ACE_Timer_List_T::cancel (long timer_id, + const void **act, + int dont_call) { ACE_TRACE ("ACE_Timer_List::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); - ACE_Timer_Node_T *prev = 0; - ACE_Timer_Node_T *curr = 0; + ACE_Timer_Node_T *prev = 0; + ACE_Timer_Node_T *curr = 0; // Try to locate the ACE_Timer_Node that matches the timer_id. @@ -246,9 +246,7 @@ ACE_Timer_List_T::cancel (long timer_id, *act = curr->act_; if (dont_call == 0) - // This calls the correct operator () on the functor (the one with - // two args) - this->upcall_functor_.operator () (*this, curr->type_); + this->upcall_functor_.cancellation (*this, curr->type_); this->free_node (curr); return 1; } @@ -259,15 +257,15 @@ ACE_Timer_List_T::cancel (long timer_id, // Locate and remove all values of from the timer queue. -template int -ACE_Timer_List_T::cancel (const TYPE &type, - int dont_call) +template int +ACE_Timer_List_T::cancel (const TYPE &type, + int dont_call) { ACE_TRACE ("ACE_Timer_List::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); - ACE_Timer_Node_T *prev = 0; - ACE_Timer_Node_T *curr = this->head_; + ACE_Timer_Node_T *prev = 0; + ACE_Timer_Node_T *curr = this->head_; int number_of_cancellations = 0; @@ -279,9 +277,8 @@ ACE_Timer_List_T::cancel (const TYPE &type, if (dont_call == 0 && number_of_cancellations == 1) - // This calls the correct operator () on the functor (the one with - // two args) - this->upcall_functor_.operator () (*this, curr->type_); + this->upcall_functor_.cancellation (*this, curr->type_); + if (prev == 0) { this->head_ = curr->next_; -- cgit v1.2.1