#include <Timer_Wheel_T.h>
Inheritance diagram for ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >:
Public Types | |
typedef ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > | Iterator |
Type of iterator. | |
typedef ACE_Timer_Node_T< TYPE > | Node |
typedef ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK > | Base |
Type inherited from. | |
typedef ACE_Free_List< Node > | FreeList |
Public Member Functions | |
ACE_Timer_Wheel_T (FUNCTOR *upcall_functor=0, FreeList *freelist=0) | |
Default constructor. | |
ACE_Timer_Wheel_T (u_int spoke_count, u_int resolution, size_t prealloc=0, FUNCTOR *upcall_functor=0, FreeList *freelist=0) | |
Constructor with opportunities to set the wheelsize and resolution. | |
virtual | ~ACE_Timer_Wheel_T (void) |
Destructor. | |
virtual bool | is_empty (void) const |
True if queue is empty, else false. | |
virtual const ACE_Time_Value & | earliest_time (void) const |
virtual int | reset_interval (long timer_id, const ACE_Time_Value &interval) |
virtual int | cancel (const TYPE &type, int dont_call_handle_close=1) |
virtual int | cancel (long timer_id, const void **act=0, int dont_call_handle_close=1) |
virtual int | expire (void) |
int | expire (const ACE_Time_Value ¤t_time) |
virtual ACE_Timer_Queue_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > & | iter (void) |
Returns a pointer to this <ACE_Timer_Queue_T>'s iterator. | |
virtual ACE_Timer_Node_T< TYPE > * | remove_first (void) |
Removes the earliest node from the queue and returns it. | |
virtual void | dump (void) const |
Dump the state of an object. | |
virtual ACE_Timer_Node_T< TYPE > * | get_first (void) |
Reads the earliest node from the queue and returns it. | |
Protected Member Functions | |
virtual long | schedule_i (const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval) |
Schedules a timer. | |
Private Member Functions | |
ACE_Timer_Node_T< TYPE > * | get_first_i (void) const |
ACE_Timer_Node_T< TYPE > * | remove_first_expired (const ACE_Time_Value &now) |
void | open_i (size_t prealloc, u_int spokes, u_int res) |
virtual void | reschedule (ACE_Timer_Node_T< TYPE > *) |
ACE_Timer_Node_T< TYPE > * | find_spoke_node (u_int spoke, long timer_id) const |
Searches for a node by timer_id within one spoke. | |
ACE_Timer_Node_T< TYPE > * | find_node (long timer_id) const |
u_int | calculate_spoke (const ACE_Time_Value &expire) const |
long | generate_timer_id (u_int spoke) |
void | schedule_i (ACE_Timer_Node_T< TYPE > *n, u_int spoke, const ACE_Time_Value &expire) |
The shared scheduling functionality between schedule() and reschedule(). | |
void | cancel_i (ACE_Timer_Node_T< TYPE > *n) |
Shared subset of the two cancel() methods. | |
void | unlink (ACE_Timer_Node_T< TYPE > *n) |
void | recalc_earliest (const ACE_Time_Value &last) |
int | power2bits (int n, int min_bits, int max_bits) |
ACE_Timer_Wheel_T (const ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK > &) | |
void | operator= (const ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK > &) |
Private Attributes | |
ACE_Timer_Node_T< TYPE > ** | spokes_ |
Timing Wheel. | |
u_int | spoke_count_ |
Size of the timing wheel. | |
int | spoke_bits_ |
Number of timer_id bits used for the spoke. | |
u_int | max_per_spoke_ |
Maximum number of timers per spoke. | |
int | res_bits_ |
Resolution (in microsoconds) of the timing wheel. | |
u_int | earliest_spoke_ |
Index of the list with the earliest time. | |
Iterator * | iterator_ |
Iterator used to expire timers. | |
ACE_Time_Value | wheel_time_ |
The total amount of time in one iteration of the wheel. (resolution * spoke_count). | |
u_int | timer_count_ |
The total number of timers currently scheduled. | |
Friends | |
class | ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > |
Iterator is a friend. |
This implementation uses a hash table of ordered doubly- linked lists of absolute times. The enhancements over the ACE_Timer_List
include adding a free list and the ability to preallocate nodes. Timer Wheel is based on the timing wheel implementation used in Adam M. Costello and George Varghese's paper "Redesigning the BSD Callout and Timer Facilities" (http://dworkin.wustl.edu/~varghese/PAPERS/newbsd.ps.Z)
Definition at line 92 of file Timer_Wheel_T.h.
typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::Base |
typedef ACE_Free_List<Node> ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::FreeList |
Definition at line 102 of file Timer_Wheel_T.h.
typedef ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::Iterator |
typedef ACE_Timer_Node_T<TYPE> ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::Node |
Definition at line 99 of file Timer_Wheel_T.h.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::ACE_Timer_Wheel_T | ( | FUNCTOR * | upcall_functor = 0 , |
|
FreeList * | freelist = 0 | |||
) |
Default constructor.
Default Constructor that sets defaults for spoke_count_ and resolution_ and doesn't do any preallocation.
upcall_functor | A pointer to a functor to use instead of the default | |
freelist | A pointer to a freelist to use instead of the default |
Definition at line 46 of file Timer_Wheel_T.cpp.
References ACE_DEFAULT_TIMER_WHEEL_RESOLUTION, ACE_DEFAULT_TIMER_WHEEL_SIZE, and ACE_TRACE.
00049 : Base (upcall_functor, freelist) 00050 , spokes_(0) 00051 , spoke_count_(0) // calculated in open_i 00052 , spoke_bits_(0) 00053 , res_bits_ (0) 00054 , earliest_spoke_ (0) 00055 , iterator_(0) 00056 , timer_count_(0) 00057 { 00058 ACE_TRACE ("ACE_Timer_Wheel_T::ACE_Timer_Wheel_T"); 00059 this->open_i (0, 00060 ACE_DEFAULT_TIMER_WHEEL_SIZE, 00061 ACE_DEFAULT_TIMER_WHEEL_RESOLUTION); 00062 }
ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::ACE_Timer_Wheel_T | ( | u_int | spoke_count, | |
u_int | resolution, | |||
size_t | prealloc = 0 , |
|||
FUNCTOR * | upcall_functor = 0 , |
|||
FreeList * | freelist = 0 | |||
) |
Constructor with opportunities to set the wheelsize and resolution.
Constructor that sets up the timing wheel and also may preallocate some nodes on the free list
spoke_count | The number of lists in the timer wheel | |
resolution | The time resolution in milliseconds used by the hashing function | |
prealloc | The number of entries to prealloc in the free_list | |
upcall_functor | A pointer to a functor to use instead of the default | |
freelist | A pointer to a freelist to use instead of the default |
Definition at line 76 of file Timer_Wheel_T.cpp.
References ACE_TRACE.
00081 : Base (upcall_functor, freelist) 00082 , spokes_ (0) 00083 , spoke_count_ (0) // calculated in open_i 00084 , spoke_bits_ (0) 00085 , res_bits_ (0) 00086 , earliest_spoke_ (0) 00087 , iterator_ (0) 00088 , timer_count_ (0) 00089 { 00090 ACE_TRACE ("ACE_Timer_Wheel_T::ACE_Timer_Wheel_T"); 00091 this->open_i (prealloc, spoke_count, resolution); 00092 }
ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::~ACE_Timer_Wheel_T | ( | void | ) | [virtual] |
Destructor.
Definition at line 168 of file Timer_Wheel_T.cpp.
References ACE_TRACE, ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::free_node(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::iterator_, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spoke_count_, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spokes_, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::upcall_functor().
00169 { 00170 ACE_TRACE ("ACE_Timer_Wheel_T::~ACE_Timer_Wheel_T"); 00171 00172 delete iterator_; 00173 00174 for (u_int i = 0; i < this->spoke_count_; ++i) 00175 { 00176 // Free all the nodes starting at the root 00177 ACE_Timer_Node_T<TYPE>* root = this->spokes_[i]; 00178 for (ACE_Timer_Node_T<TYPE>* n = root->get_next (); n != root;) 00179 { 00180 ACE_Timer_Node_T<TYPE>* next = n->get_next (); 00181 this->upcall_functor ().deletion (*this, 00182 n->get_type (), 00183 n->get_act ()); 00184 this->free_node (n); 00185 n = next; 00186 } 00187 delete root; 00188 } 00189 delete[] this->spokes_; 00190 }
ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::ACE_Timer_Wheel_T | ( | const ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK > & | ) | [private] |
u_int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::calculate_spoke | ( | const ACE_Time_Value & | t | ) | const [private] |
Uses a simple hash to find which spoke to use based on when the timer is due to expire. Hopefully the 64bit int operations avoid any overflow problems.
Definition at line 273 of file Timer_Wheel_T.cpp.
References ACE_Time_Value::msec().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::reschedule(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::schedule_i().
00274 { 00275 return static_cast<u_int> ((t.msec () >> this->res_bits_) & (this->spoke_count_ - 1)); 00276 }
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel | ( | long | timer_id, | |
const void ** | act = 0 , |
|||
int | skip_close = 1 | |||
) | [virtual] |
Cancels the single timer that is specified by the timer_id. In this case the timer_id is actually a pointer to the node, so we cast it to the node. This can be dangerous if the timer_id is made up (or deleted twice) so we do a little sanity check. Finally we update the earliest time in case the earliest timer was removed.
timer_id | Timer Identifier | |
act | Asychronous Completion Token (AKA magic cookie): If this is non-zero, stores the magic cookie of the cancelled timer here. | |
skip_close | If this non-zero, the cancellation method of the functor will not be called. |
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 593 of file Timer_Wheel_T.cpp.
References ACE_GUARD_RETURN, ACE_TRACE, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel_i(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::find_node(), ACE_Timer_Node_T< TYPE >::get_act(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first_i(), ACE_Timer_Node_T< TYPE >::get_timer_value(), ACE_Timer_Node_T< TYPE >::get_type(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::recalc_earliest(), and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::upcall_functor().
00596 { 00597 ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); 00598 ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); 00599 ACE_Timer_Node_T<TYPE>* n = this->find_node (timer_id); 00600 if (n != 0) 00601 { 00602 ACE_Time_Value last = n->get_timer_value (); 00603 00604 int recalc = (this->get_first_i () == n); 00605 00606 // Call the close hooks. 00607 int cookie = 0; 00608 00609 // cancel_type() called once per <type>. 00610 this->upcall_functor ().cancel_type (*this, 00611 n->get_type (), 00612 skip_close, 00613 cookie); 00614 00615 // cancel_timer() called once per <timer>. 00616 this->upcall_functor ().cancel_timer (*this, 00617 n->get_type (), 00618 skip_close, 00619 cookie); 00620 if (act != 0) 00621 *act = n->get_act (); 00622 00623 this->cancel_i (n); 00624 00625 if (recalc) 00626 this->recalc_earliest (last); 00627 00628 return 1; 00629 } 00630 return 0; 00631 }
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel | ( | const TYPE & | type, | |
int | dont_call_handle_close = 1 | |||
) | [virtual] |
Cancel all timer associated with type. If <dont_call> is 0 then the <functor> will be invoked. Returns number of timers cancelled.
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 510 of file Timer_Wheel_T.cpp.
References ACE_GUARD_RETURN, ACE_TRACE, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel_i(), ACE_Timer_Node_T< TYPE >::get_next(), ACE_Timer_Node_T< TYPE >::get_type(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::recalc_earliest(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spoke_count_, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::upcall_functor().
00511 { 00512 ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); 00513 00514 int num_canceled = 0; // Note : Technically this can overflow. 00515 int cookie = 0; 00516 00517 ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); 00518 00519 if (!this->is_empty ()) 00520 { 00521 ACE_Timer_Node_T<TYPE>* first = this->get_first (); 00522 ACE_Time_Value last = first->get_timer_value (); 00523 int recalc = 0; 00524 00525 for (u_int i = 0; i < this->spoke_count_; ++i) 00526 { 00527 ACE_Timer_Node_T<TYPE>* root = this->spokes_[i]; 00528 for (ACE_Timer_Node_T<TYPE>* n = root->get_next (); n != root; ) 00529 { 00530 if (n->get_type () == type) 00531 { 00532 ++num_canceled; 00533 if (n == first) 00534 recalc = 1; 00535 00536 ACE_Timer_Node_T<TYPE>* tmp = n; 00537 n = n->get_next (); 00538 00539 this->cancel_i (tmp); 00540 } 00541 else 00542 { 00543 n = n->get_next (); 00544 } 00545 } 00546 } 00547 00548 if (recalc) 00549 this->recalc_earliest (last); 00550 } 00551 00552 // Call the close hooks. 00553 00554 // cancel_type() called once per <type>. 00555 this->upcall_functor ().cancel_type (*this, 00556 type, 00557 skip_close, 00558 cookie); 00559 00560 for (int i = 0; 00561 i < num_canceled; 00562 ++i) 00563 { 00564 // cancel_timer() called once per <timer>. 00565 this->upcall_functor ().cancel_timer (*this, 00566 type, 00567 skip_close, 00568 cookie); 00569 } 00570 00571 return num_canceled; 00572 }
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel_i | ( | ACE_Timer_Node_T< TYPE > * | n | ) | [private] |
Shared subset of the two cancel() methods.
Definition at line 635 of file Timer_Wheel_T.cpp.
References ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::free_node(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::unlink().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel().
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::dump | ( | void | ) | const [virtual] |
Dump the state of an object.
Dumps out the size of the wheel, the resolution, and the contents of the wheel.
Reimplemented from ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 691 of file Timer_Wheel_T.cpp.
References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, ACE_Timer_Node_T< TYPE >::dump(), ACE_Timer_Node_T< TYPE >::get_next(), LM_DEBUG, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spoke_count_, and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spokes_.
00692 { 00693 #if defined (ACE_HAS_DUMP) 00694 ACE_TRACE ("ACE_Timer_Wheel_T::dump"); 00695 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00696 00697 ACE_DEBUG ((LM_DEBUG, 00698 ACE_TEXT ("\nspoke_count_ = %d"), this->spoke_count_)); 00699 ACE_DEBUG ((LM_DEBUG, 00700 ACE_TEXT ("\nresolution_ = %d"), 1 << this->res_bits_)); 00701 ACE_DEBUG ((LM_DEBUG, 00702 ACE_TEXT ("\nwheel_ = \n"))); 00703 00704 for (u_int i = 0; i < this->spoke_count_; ++i) 00705 { 00706 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d\n"), i)); 00707 ACE_Timer_Node_T<TYPE>* root = this->spokes_[i]; 00708 for (ACE_Timer_Node_T<TYPE>* n = root->get_next (); 00709 n != root; 00710 n = n->get_next ()) 00711 { 00712 n->dump (); 00713 } 00714 } 00715 00716 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00717 #endif /* ACE_HAS_DUMP */ 00718 }
const ACE_Time_Value & ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::earliest_time | ( | void | ) | const [virtual] |
Returns the time of the earlier node in the ACE_Timer_Wheel. Must be called on a non-empty queue.
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 259 of file Timer_Wheel_T.cpp.
References ACE_TRACE, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first_i(), ACE_Timer_Node_T< TYPE >::get_timer_value(), and ACE_Time_Value::zero.
00260 { 00261 ACE_TRACE ("ACE_Timer_Wheel_T::earliest_time"); 00262 ACE_Timer_Node_T<TYPE>* n = this->get_first_i (); 00263 if (n != 0) 00264 return n->get_timer_value (); 00265 return ACE_Time_Value::zero; 00266 }
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::expire | ( | const ACE_Time_Value & | cur_time | ) | [virtual] |
This is a specialized version of expire that is more suited for the internal data representation.
cur_time | The time to expire timers up to. |
Reimplemented from ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 812 of file Timer_Wheel_T.cpp.
References ACE_GUARD_RETURN, ACE_TRACE, ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::free_node(), ACE_Timer_Node_T< TYPE >::get_dispatch_info(), ACE_Timer_Node_T< TYPE >::get_interval(), ACE_Timer_Node_T< TYPE >::get_timer_value(), ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::postinvoke(), ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::preinvoke(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first_expired(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::reschedule(), ACE_Timer_Node_T< TYPE >::set_timer_value(), ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::upcall(), and ACE_Time_Value::zero.
00813 { 00814 ACE_TRACE ("ACE_Timer_Wheel_T::expire"); 00815 00816 int expcount = 0; 00817 00818 ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); 00819 00820 ACE_Timer_Node_T<TYPE>* n = this->remove_first_expired (cur_time); 00821 00822 while (n != 0) 00823 { 00824 ++expcount; 00825 00826 //ACE_ERROR((LM_ERROR, "Expiring %x\n", (long) n)); 00827 00828 ACE_Timer_Node_Dispatch_Info_T<TYPE> info; 00829 00830 // Get the dispatch info 00831 n->get_dispatch_info (info); 00832 00833 if (n->get_interval () > ACE_Time_Value::zero) 00834 { 00835 // Make sure that we skip past values that have already 00836 // "expired". 00837 do 00838 n->set_timer_value (n->get_timer_value () + 00839 n->get_interval ()); 00840 while (n->get_timer_value () <= cur_time); 00841 00842 this->reschedule (n); 00843 } 00844 else 00845 { 00846 this->free_node (n); 00847 } 00848 00849 const void *upcall_act = 0; 00850 00851 this->preinvoke (info, cur_time, upcall_act); 00852 00853 this->upcall (info, cur_time); 00854 00855 this->postinvoke (info, cur_time, upcall_act); 00856 00857 n = this->remove_first_expired (cur_time); 00858 } 00859 00860 return expcount; 00861 }
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::expire | ( | void | ) | [virtual] |
Run the <functor> for all timers whose values are <= <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. Returns the number of timers canceled.
Reimplemented from ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 798 of file Timer_Wheel_T.cpp.
References ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::expire().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::reschedule().
00799 { 00800 return ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::expire (); 00801 }
ACE_Timer_Node_T< TYPE > * ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::find_node | ( | long | timer_id | ) | const [private] |
Searches all spokes for a node matching the specified timer_id Uses the spoke encoded in the timer_id as a starting place.
Definition at line 213 of file Timer_Wheel_T.cpp.
References ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::find_spoke_node(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spoke_count_.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::reset_interval().
00214 { 00215 if (timer_id == -1) 00216 return 0; 00217 00218 // Search the spoke where timer_id was originally scheduled 00219 u_int spoke_mask = this->spoke_count_ - 1; 00220 u_int start = timer_id & spoke_mask; 00221 ACE_Timer_Node_T<TYPE>* n = this->find_spoke_node (start, timer_id); 00222 if (n != 0) 00223 return n; 00224 00225 //ACE_ERROR((LM_ERROR, "Node not found in original spoke.\n")); 00226 00227 // Search the rest of the spokes 00228 for (u_int i = 0; i < this->spoke_count_; ++i) 00229 { 00230 if (i != start) 00231 { // already searched this one 00232 n = this->find_spoke_node (i, timer_id); 00233 if (n != 0) 00234 return n; 00235 } 00236 } 00237 00238 //ACE_ERROR((LM_ERROR, "Node not found.\n")); 00239 return 0; 00240 }
ACE_Timer_Node_T< TYPE > * ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::find_spoke_node | ( | u_int | spoke, | |
long | timer_id | |||
) | const [private] |
Searches for a node by timer_id within one spoke.
Definition at line 196 of file Timer_Wheel_T.cpp.
References ACE_Timer_Node_T< TYPE >::get_next().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::find_node().
00197 { 00198 ACE_Timer_Node_T<TYPE>* root = this->spokes_[spoke]; 00199 for (ACE_Timer_Node_T<TYPE>* n = root->get_next (); 00200 n != root; 00201 n = n->get_next ()) 00202 { 00203 if (n->get_timer_id () == timer_id) 00204 return n; 00205 } 00206 return 0; 00207 }
long ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::generate_timer_id | ( | u_int | spoke | ) | [private] |
Generates a unique timer_id for the given spoke. It should be pretty fast until the point where the counter overflows. At that time you have to do exhaustive searches within the spoke to ensure that a particular timer id is not already in use. Some optimizations are in place so that this hopefully doesn't have to happen often.
Definition at line 284 of file Timer_Wheel_T.cpp.
References ACE_Timer_Node_T< TYPE >::get_act(), ACE_Timer_Node_T< TYPE >::get_next(), ACE_Timer_Node_T< TYPE >::get_timer_id(), ACE_Timer_Node_T< TYPE >::set_act(), ACE_Timer_Node_T< TYPE >::set_timer_id(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spoke_bits_, and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spokes_.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::schedule_i().
00285 { 00286 00287 int cnt_bits = sizeof (long) * 8 - this->spoke_bits_; 00288 long max_cnt = ((long)1 << cnt_bits) - 1; 00289 if (spoke == this->spoke_count_) 00290 --max_cnt; // Because -1 is used as a special invalid timer_id. 00291 00292 ACE_Timer_Node_T<TYPE>* root = this->spokes_[spoke]; 00293 00294 if (root == root->get_next ()) 00295 root->set_act(0); 00296 00297 // We use this field to keep track of the next counter value that 00298 // may be in use. Of course it may have expired, so we just use 00299 // this field so that we know when we don't have to check for duplicates 00300 #if defined (ACE_WIN64) 00301 // The cast below is legit... we know that long is shorter than a 00302 // pointer, but are only using it as a 'long' storage area. 00303 # pragma warning(push) 00304 # pragma warning(disable : 4311) 00305 #endif /* ACE_WIN64 */ 00306 long next_cnt = reinterpret_cast<long> (root->get_act ()); 00307 #if defined (ACE_WIN64) 00308 # pragma warning(pop) 00309 #endif /* ACE_WIN64 */ 00310 00311 // This field is used as a counter instead of a timer_id. 00312 long cnt = root->get_timer_id (); 00313 00314 if (cnt >= max_cnt && root == root->get_next ()) 00315 { 00316 // Special case when we overflow on an empty spoke. We can just 00317 // wrap the count around without searching for duplicates. We only 00318 // want to do this when the counter overflows, so that we return 00319 // unique timer_id values as often as possible. 00320 root->set_timer_id (1); 00321 return spoke; 00322 } 00323 else if (cnt >= max_cnt) 00324 { // overflow 00325 cnt = 0; // try again starting at zero 00326 } 00327 else if (next_cnt == 0 || cnt < next_cnt) 00328 { 00329 root->set_timer_id (cnt + 1); 00330 return (cnt << this->spoke_bits_) | spoke; 00331 } 00332 00333 //ACE_ERROR((LM_ERROR, "Timer id overflow. We have to search now.\n")); 00334 00335 // We've run out of consecutive id numbers so now we have to search 00336 // for a unique id. 00337 // We'll try increasing numbers until we find one that is not in use, 00338 // and we'll record the next highest number so that we can avoid this 00339 // search as often as possible. 00340 for (; cnt < max_cnt - 1; ++cnt) 00341 { 00342 long id = (cnt << this->spoke_bits_) | spoke; 00343 ACE_Timer_Node_T<TYPE>* n = this->find_spoke_node (spoke, id); 00344 if (n == 0) 00345 { 00346 root->set_timer_id (cnt + 1); 00347 // Now we need to find the next highest cnt in use 00348 next_cnt = 0; 00349 for (; n != root; n = n->get_next ()) 00350 { 00351 long tmp = n->get_timer_id () >> this->spoke_bits_; 00352 if (tmp > cnt && (tmp < next_cnt || next_cnt == 0)) 00353 next_cnt = tmp; 00354 } 00355 #if defined (ACE_WIN64) 00356 // The cast below is legit... we know we're storing a long in 00357 // a pointer, but are only using it as a 'long' storage area. 00358 # pragma warning(push) 00359 # pragma warning(disable : 4312) 00360 #endif /* ACE_WIN64 */ 00361 root->set_act (reinterpret_cast<void*> (next_cnt)); 00362 #if defined (ACE_WIN64) 00363 # pragma warning(pop) 00364 #endif /* ACE_WIN64 */ 00365 return id; 00366 } 00367 } 00368 00369 return -1; // We did our best, but the spoke is full. 00370 }
ACE_Timer_Node_T< TYPE > * ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first | ( | void | ) | [virtual] |
Reads the earliest node from the queue and returns it.
Returns the earliest node without removing it
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 764 of file Timer_Wheel_T.cpp.
References ACE_TRACE, and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first_i().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first_expired().
00765 { 00766 ACE_TRACE ("ACE_Timer_Wheel_T::get_first"); 00767 return this->get_first_i (); 00768 }
ACE_Timer_Node_T< TYPE > * ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first_i | ( | void | ) | const [private] |
Definition at line 772 of file Timer_Wheel_T.cpp.
References ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::earliest_spoke_, ACE_Timer_Node_T< TYPE >::get_next(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spokes_.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::earliest_time(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first().
00773 { 00774 ACE_Timer_Node_T<TYPE>* root = this->spokes_[this->earliest_spoke_]; 00775 ACE_Timer_Node_T<TYPE>* first = root->get_next (); 00776 if (first != root) 00777 return first; 00778 return 0; 00779 }
bool ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::is_empty | ( | void | ) | const [virtual] |
True if queue is empty, else false.
Check to see if the wheel is empty
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 248 of file Timer_Wheel_T.cpp.
References ACE_TRACE, and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::timer_count_.
00249 { 00250 ACE_TRACE ("ACE_Timer_Wheel_T::is_empty"); 00251 return timer_count_ == 0; 00252 }
ACE_Timer_Queue_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > & ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::iter | ( | void | ) | [virtual] |
Returns a pointer to this <ACE_Timer_Queue_T>'s iterator.
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 787 of file Timer_Wheel_T.cpp.
References ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK >::first(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::iterator_.
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::open_i | ( | size_t | prealloc, | |
u_int | spokes, | |||
u_int | res | |||
) | [private] |
Initialize the queue. Uses the established members for all needed information.
Definition at line 132 of file Timer_Wheel_T.cpp.
References ACE_NEW, ACE_TRACE, ACE_OS::gettimeofday(), and ACE_Time_Value::zero.
00133 { 00134 ACE_TRACE ("ACE_Timer_Wheel_T::open_i"); 00135 00136 this->gettimeofday (ACE_OS::gettimeofday); 00137 00138 // Rather than waste bits in our timer id, we might as well round up 00139 // the spoke count to the next power of two - 1 . (i.e 1,3,7,15,...127,etc.) 00140 const int MIN_SPOKE_BITS = 3; // Allow between 8 and 4096 spokes 00141 const int MAX_SPOKE_BITS = 12; 00142 const int MAX_RES_BITS = 20; // 20 is plenty, even on 64 bit platforms. 00143 00144 this->spoke_bits_ = power2bits (spokes, MIN_SPOKE_BITS, MAX_SPOKE_BITS); 00145 this->res_bits_ = power2bits (res, 1, MAX_RES_BITS); 00146 00147 this->spoke_count_ = 1 << this->spoke_bits_; 00148 00149 this->free_list_->resize (prealloc + this->spoke_count_); 00150 00151 this->wheel_time_.msec (1 << (this->res_bits_ + this->spoke_bits_)); 00152 00153 ACE_NEW (this->spokes_, ACE_Timer_Node_T<TYPE>* [this->spoke_count_]); 00154 00155 // Create the root nodes. These will be treated specially 00156 for (u_int i = 0; i < this->spoke_count_; ++i) 00157 { 00158 ACE_Timer_Node_T<TYPE>* root = this->alloc_node (); 00159 root->set (0, 0, ACE_Time_Value::zero, ACE_Time_Value::zero, root, root, 0); 00160 this->spokes_[i] = root; 00161 } 00162 00163 ACE_NEW (iterator_, Iterator (*this)); 00164 }
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::operator= | ( | const ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK > & | ) | [private] |
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::power2bits | ( | int | n, | |
int | min_bits, | |||
int | max_bits | |||
) | [private] |
Definition at line 95 of file Timer_Wheel_T.cpp.
00098 { 00099 int max = (1 << max_bits) - 1; 00100 if (n > max) 00101 return max_bits; 00102 00103 // count the bits in n. 00104 int i = 0; 00105 int tmp = n; 00106 do 00107 { 00108 tmp >>= 1; 00109 ++i; 00110 } 00111 while (tmp != 0); 00112 00113 if (i <= min_bits) 00114 return min_bits; 00115 00116 // Which is nearest? 00117 int a = (1 << i) - n; 00118 int b = (1 << (i - 1)) - n; 00119 if (b < 0) 00120 b = -b; 00121 if (b < a) 00122 return i - 1; 00123 return i; 00124 }
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::recalc_earliest | ( | const ACE_Time_Value & | last | ) | [private] |
There are a few places where we have to figure out which timer will expire next. This method makes the assumption that spokes are always sorted, and that timers are always in the correct spoke determined from their expiration time. The last time is always passed in, even though you can often calculate it as get_first()->get_timer_value().
Definition at line 649 of file Timer_Wheel_T.cpp.
References ACE_Timer_Node_T< TYPE >::get_next(), ACE_Timer_Node_T< TYPE >::get_timer_value(), and ACE_Time_Value::zero.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first_expired().
00650 { 00651 // This is possible because we use a count for is_empty() 00652 if (this->is_empty ()) 00653 return; 00654 00655 ACE_Time_Value et = ACE_Time_Value::zero; 00656 u_int es = 0; 00657 u_int spoke = this->earliest_spoke_; 00658 00659 // We will have to go around the wheel at most one time. 00660 for (u_int i = 0; i < this->spoke_count_; ++i) 00661 { 00662 ACE_Timer_Node_T<TYPE>* root = this->spokes_[spoke]; 00663 ACE_Timer_Node_T<TYPE>* n = root->get_next (); 00664 if (n != root) 00665 { 00666 ACE_Time_Value t = n->get_timer_value (); 00667 if (t < last + this->wheel_time_) 00668 { 00669 this->earliest_spoke_ = spoke; 00670 return; 00671 } 00672 else if (et == ACE_Time_Value::zero || t < et) 00673 { 00674 et = t; 00675 es = spoke; 00676 } 00677 } 00678 if (++spoke >= this->spoke_count_) 00679 spoke = 0; 00680 } 00681 00682 this->earliest_spoke_ = es; 00683 //ACE_ERROR((LM_ERROR, "We had to search the whole wheel.\n")); 00684 }
ACE_Timer_Node_T< TYPE > * ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first | ( | void | ) | [virtual] |
Removes the earliest node from the queue and returns it.
Removes the earliest node and then find the new <earliest_spoke_>
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 727 of file Timer_Wheel_T.cpp.
References ACE_TRACE, ACE_Time_Value::max_time, and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first_expired().
00728 { 00729 ACE_TRACE ("ACE_Timer_Wheel_T::remove_first"); 00730 return remove_first_expired (ACE_Time_Value::max_time); 00731 }
ACE_Timer_Node_T< TYPE > * ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first_expired | ( | const ACE_Time_Value & | now | ) | [private] |
Definition at line 745 of file Timer_Wheel_T.cpp.
References ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first(), ACE_Timer_Node_T< TYPE >::get_timer_value(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::recalc_earliest().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::expire(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first().
00746 { 00747 ACE_Timer_Node_T<TYPE>* n = this->get_first (); 00748 if (n != 0 && n->get_timer_value() <= now) 00749 { 00750 this->unlink (n); 00751 this->recalc_earliest (n->get_timer_value ()); 00752 return n; 00753 } 00754 return 0; 00755 }
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::reschedule | ( | ACE_Timer_Node_T< TYPE > * | n | ) | [private, virtual] |
Takes an ACE_Timer_Node and inserts it into the correct position in the correct list. Also makes sure to update the earliest time.
n | The timer node to reschedule |
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 422 of file Timer_Wheel_T.cpp.
References ACE_TRACE, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::calculate_spoke(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::expire(), ACE_Timer_Node_T< TYPE >::get_timer_value(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::schedule_i().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::expire().
00423 { 00424 ACE_TRACE ("ACE_Timer_Wheel_T::reschedule"); 00425 const ACE_Time_Value& expire = n->get_timer_value (); 00426 u_int spoke = calculate_spoke (expire); 00427 this->schedule_i (n, spoke, expire); 00428 }
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::reset_interval | ( | long | timer_id, | |
const ACE_Time_Value & | interval | |||
) | [virtual] |
Changes the interval of a timer (and can make it periodic or non periodic by setting it to ACE_Time_Value::zero or not).
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 480 of file Timer_Wheel_T.cpp.
References ACE_GUARD_RETURN, ACE_TRACE, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::find_node(), and ACE_Timer_Node_T< TYPE >::set_interval().
00483 { 00484 ACE_TRACE ("ACE_Timer_Wheel_T::reset_interval"); 00485 ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); 00486 ACE_Timer_Node_T<TYPE>* n = this->find_node (timer_id); 00487 if (n != 0) 00488 { 00489 // The interval will take effect the next time this node is expired. 00490 n->set_interval (interval); 00491 return 0; 00492 } 00493 return -1; 00494 }
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::schedule_i | ( | ACE_Timer_Node_T< TYPE > * | n, | |
u_int | spoke, | |||
const ACE_Time_Value & | expire | |||
) | [private] |
The shared scheduling functionality between schedule() and reschedule().
Definition at line 433 of file Timer_Wheel_T.cpp.
References ACE_Timer_Node_T< TYPE >::get_next(), ACE_Timer_Node_T< TYPE >::get_prev(), ACE_Timer_Node_T< TYPE >::get_timer_value(), ACE_Timer_Node_T< TYPE >::set_next(), and ACE_Timer_Node_T< TYPE >::set_prev().
00436 { 00437 // See if we need to update the earliest time 00438 if (this->is_empty() || expire < this->earliest_time ()) 00439 this->earliest_spoke_ = spoke; 00440 00441 ACE_Timer_Node_T<TYPE>* root = this->spokes_[spoke]; 00442 ACE_Timer_Node_T<TYPE>* last = root->get_prev (); 00443 00444 ++timer_count_; 00445 00446 // If the spoke is empty 00447 if (last == root) { 00448 n->set_prev (root); 00449 n->set_next (root); 00450 root->set_prev (n); 00451 root->set_next (n); 00452 return; 00453 } 00454 00455 // We always want to search backwards from the tail of the list, because 00456 // this minimizes the search in the extreme case when lots of timers are 00457 // scheduled for exactly the same time 00458 ACE_Timer_Node_T<TYPE>* p = root->get_prev (); 00459 while (p != root && p->get_timer_value () > expire) 00460 p = p->get_prev (); 00461 00462 // insert after 00463 n->set_prev (p); 00464 n->set_next (p->get_next ()); 00465 p->get_next ()->set_prev (n); 00466 p->set_next (n); 00467 }
long ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::schedule_i | ( | const TYPE & | type, | |
const void * | act, | |||
const ACE_Time_Value & | future_time, | |||
const ACE_Time_Value & | interval | |||
) | [protected, virtual] |
Schedules a timer.
Creates a ACE_Timer_Node_T based on the input parameters. Then inserts the node into the wheel using reschedule (). Then returns a timer_id.
type | The data of the timer node | |
act | Asynchronous Completion Token (AKA magic cookie) | |
future_time | The time the timer is scheduled for (absolute time) | |
interval | If not ACE_Time_Value::zero, then this is a periodic timer and interval is the time period |
Implements ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.
Definition at line 386 of file Timer_Wheel_T.cpp.
References ACE_TRACE, ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::alloc_node(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::calculate_spoke(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::generate_timer_id(), and ACE_Timer_Node_T< TYPE >::set().
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::reschedule().
00390 { 00391 ACE_TRACE ("ACE_Timer_Wheel_T::schedule_i"); 00392 00393 ACE_Timer_Node_T<TYPE>* n = this->alloc_node (); 00394 00395 if (n != 0) 00396 { 00397 u_int spoke = calculate_spoke (future_time); 00398 long id = generate_timer_id (spoke); 00399 00400 //ACE_ERROR((LM_ERROR, "Scheduling %x spoke:%d id:%d\n", (long) n, spoke, id)); 00401 00402 if (id != -1) 00403 { 00404 n->set (type, act, future_time, interval, 0, 0, id); 00405 this->schedule_i (n, spoke, future_time); 00406 } 00407 return id; 00408 } 00409 00410 // Failure return 00411 errno = ENOMEM; 00412 return -1; 00413 }
void ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::unlink | ( | ACE_Timer_Node_T< TYPE > * | n | ) | [private] |
Definition at line 734 of file Timer_Wheel_T.cpp.
References ACE_TRACE, ACE_Timer_Node_T< TYPE >::get_next(), ACE_Timer_Node_T< TYPE >::get_prev(), ACE_Timer_Node_T< TYPE >::set_next(), ACE_Timer_Node_T< TYPE >::set_prev(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::timer_count_.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel_i().
00735 { 00736 ACE_TRACE ("ACE_Timer_Wheel_T::unlink"); 00737 --timer_count_; 00738 n->get_prev ()->set_next (n->get_next ()); 00739 n->get_next ()->set_prev (n->get_prev ()); 00740 n->set_prev (0); 00741 n->set_next (0); 00742 }
friend class ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > [friend] |
u_int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::earliest_spoke_ [private] |
Index of the list with the earliest time.
Definition at line 201 of file Timer_Wheel_T.h.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first_i().
Iterator* ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::iterator_ [private] |
Iterator used to expire timers.
Definition at line 203 of file Timer_Wheel_T.h.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::iter(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::~ACE_Timer_Wheel_T().
u_int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::max_per_spoke_ [private] |
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::res_bits_ [private] |
int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spoke_bits_ [private] |
Number of timer_id bits used for the spoke.
Definition at line 195 of file Timer_Wheel_T.h.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::generate_timer_id().
u_int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spoke_count_ [private] |
Size of the timing wheel.
Definition at line 193 of file Timer_Wheel_T.h.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::cancel(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::dump(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::find_node(), ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK >::goto_next(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::~ACE_Timer_Wheel_T().
ACE_Timer_Node_T<TYPE>** ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::spokes_ [private] |
Timing Wheel.
Definition at line 191 of file Timer_Wheel_T.h.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::dump(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::generate_timer_id(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::get_first_i(), ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK >::next(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::~ACE_Timer_Wheel_T().
u_int ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::timer_count_ [private] |
The total number of timers currently scheduled.
Definition at line 207 of file Timer_Wheel_T.h.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::is_empty(), and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::unlink().
ACE_Time_Value ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::wheel_time_ [private] |
The total amount of time in one iteration of the wheel. (resolution * spoke_count).
Definition at line 205 of file Timer_Wheel_T.h.