#include <Timer_Wheel_T.h>
Inheritance diagram for ACE_Timer_Wheel_T:
Public Types | |
typedef ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > | WHEEL_ITERATOR |
Type of iterator. More... | |
typedef ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK > | INHERITED |
Type inherited from. More... | |
Public Methods | |
ACE_Timer_Wheel_T (FUNCTOR *upcall_functor=0, ACE_Free_List< ACE_Timer_Node_T< TYPE > > *freelist=0) | |
Default constructor. More... | |
ACE_Timer_Wheel_T (size_t wheelsize, size_t resolution, size_t prealloc=0, FUNCTOR *upcall_functor=0, ACE_Free_List< ACE_Timer_Node_T< TYPE > > *freelist=0) | |
Constructor with opportunities to set the wheelsize and resolution. More... | |
virtual | ~ACE_Timer_Wheel_T (void) |
Destructor. More... | |
virtual int | is_empty (void) const |
True if queue is empty, else false. More... | |
virtual const ACE_Time_Value & | earliest_time (void) const |
Returns the time of the earlier node in the <ACE_Timer_Wheel>. Must be called on a non-empty queue. More... | |
virtual long | schedule (const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval=ACE_Time_Value::zero) |
Schedules a timer. More... | |
virtual int | reset_interval (long timer_id, const ACE_Time_Value &interval) |
Changes the interval of a timer (and can make it periodic or non periodic by setting it to ACE_Time_Value::zero or not). More... | |
virtual int | cancel (const TYPE &type, int dont_call_handle_close=1) |
Cancel all timer associated with <type>. If <dont_call> is 0 then the <functor> will be invoked. Returns number of timers cancelled. More... | |
virtual int | cancel (long timer_id, const void **act=0, int dont_call_handle_close=1) |
Cancels the single timer that is specified by the timer_id. More... | |
virtual int | expire (void) |
Run the <functor> for all timers whose values are <= <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. Returns the number of timers canceled. More... | |
int | expire (const ACE_Time_Value &) |
This is a specialized version of expire that is more suited for the internal data representation. More... | |
virtual ACE_Timer_Queue_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > & | iter (void) |
Returns a pointer to this <ACE_Timer_Queue_T>'s iterator. More... | |
virtual ACE_Timer_Node_T< TYPE > * | remove_first (void) |
Removes the earliest node from the queue and returns it. More... | |
virtual void | dump (void) const |
Dump the state of an object. More... | |
virtual ACE_Timer_Node_T< TYPE > * | get_first (void) |
Reads the earliest node from the queue and returns it. More... | |
Private Methods | |
virtual void | reschedule (ACE_Timer_Node_T< TYPE > *) |
Reschedule an "interval" node. More... | |
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 > ** | wheel_ |
Timing Wheel. More... | |
size_t | wheel_size_ |
Size of the timing wheel. More... | |
size_t | resolution_ |
Resolution (in microsoconds) of the timing wheel. More... | |
size_t | earliest_pos_ |
Index of the list with the earliest time. More... | |
long | size_ |
Keeps track of the size of the queue. More... | |
WHEEL_ITERATOR * | iterator_ |
Iterator used to expire timers. More... | |
ACE_Timer_Node_T< TYPE > * | freelist_ |
Pointer to the freelist of <ACE_Timer_Node_T<TYPE>>. More... | |
Friends | |
class | ACE_Timer_Wheel_Iterator_T< TYPE, FUNCTOR, ACE_LOCK > |
Iterator is a friend. More... |
This implementation uses a hash table of ordered doubly- linked lists of absolute times. The enhancements to the <ACE_Timer_List> include using the pointer to the node as the timer id (to speed up removing), 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)
|
Type inherited from.
|
|
Type of iterator.
|
|
Default constructor.
|
|
Constructor with opportunities to set the wheelsize and resolution.
|
|
Destructor.
|
|
|
|
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.
Reimplemented from ACE_Timer_Queue_T. |
|
Cancel all timer associated with <type>. If <dont_call> is 0 then the <functor> will be invoked. Returns number of timers cancelled. At the end make sure we reset the earliest time value in case the earliest timers were removed.
Reimplemented from ACE_Timer_Queue_T. |
|
Dump the state of an object.
Reimplemented from ACE_Timer_Queue_T. |
|
Returns the time of the earlier node in the <ACE_Timer_Wheel>. Must be called on a non-empty queue.
Reimplemented from ACE_Timer_Queue_T. |
|
This is a specialized version of expire that is more suited for the internal data representation. Notice that we are still expiring timers in order, even though this can be really speeded up if we didn't worry about this.
Reimplemented from ACE_Timer_Queue_T. |
|
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. |
|
Reads the earliest node from the queue and returns it.
Reimplemented from ACE_Timer_Queue_T. |
|
True if queue is empty, else false.
Reimplemented from ACE_Timer_Queue_T. |
|
Returns a pointer to this <ACE_Timer_Queue_T>'s iterator.
Reimplemented from ACE_Timer_Queue_T. |
|
|
|
Removes the earliest node from the queue and returns it.
Reimplemented from ACE_Timer_Queue_T. |
|
Reschedule an "interval" node. Also makes sure to update the earliest time.
Reimplemented from ACE_Timer_Queue_T. |
|
Changes the interval of a timer (and can make it periodic or non periodic by setting it to ACE_Time_Value::zero or not). Then use set_interval() on the node to update the interval.
Reimplemented from ACE_Timer_Queue_T. |
|
Schedules a timer. Then inserts the node into the wheel using reschedule (). Then returns a timer_id (which is actually a pointer to the actual timer_node).
Reimplemented from ACE_Timer_Queue_T. |
|
Iterator is a friend.
|
|
Index of the list with the earliest time.
|
|
Pointer to the freelist of <ACE_Timer_Node_T<TYPE>>.
|
|
Iterator used to expire timers.
|
|
Resolution (in microsoconds) of the timing wheel.
|
|
Keeps track of the size of the queue.
|
|
Timing Wheel.
|
|
Size of the timing wheel.
|