ACE
6.2.3

Base class for all timer queues of a single type. More...
#include <Abstract_Timer_Queue.h>
Public Types  
typedef ACE_Timer_Queue_Iterator_T < TYPE >  ITERATOR 
Type of Iterator. More...  
Public Member Functions  
virtual  ~ACE_Abstract_Timer_Queue (void)=0 
Destructor. More...  
virtual bool  is_empty (void) const =0 
True if queue is empty, else false. More...  
virtual const ACE_Time_Value &  earliest_time (void) const =0 
virtual long  schedule (const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval=ACE_Time_Value::zero)=0 
virtual int  expire (const ACE_Time_Value ¤t_time)=0 
virtual int  expire (void)=0 
virtual int  expire_single (ACE_Command_Base &pre_dispatch_command)=0 
virtual int  reset_interval (long timer_id, const ACE_Time_Value &interval)=0 
virtual int  cancel (const TYPE &type, int dont_call_handle_close=1)=0 
virtual int  cancel (long timer_id, const void **act=0, int dont_call_handle_close=1)=0 
virtual int  close (void)=0 
virtual ACE_Time_Value  gettimeofday (void)=0 
virtual void  gettimeofday (ACE_Time_Value(*gettimeofday)(void))=0 
virtual ACE_Time_Value *  calculate_timeout (ACE_Time_Value *max)=0 
virtual ACE_Time_Value *  calculate_timeout (ACE_Time_Value *max, ACE_Time_Value *the_timeout)=0 
virtual ACE_Time_Value  current_time ()=0 
virtual ITERATOR &  iter (void)=0 
Returns a pointer to this ACE_Timer_Queue's iterator. More...  
virtual ACE_Timer_Node_T< TYPE > *  remove_first (void)=0 
Removes the earliest node from the queue and returns it. More...  
virtual ACE_Timer_Node_T< TYPE > *  get_first (void)=0 
Reads the earliest node from the queue and returns it. More...  
virtual void  dump (void) const =0 
Dump the state of a object. More...  
Base class for all timer queues of a single type.
This is a base class for all the timer queues, regardless of locking strategy, upcall mechanism, internal implementation, etc. The class was motivated by bug 3706: http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3706 In short, the Reactor (and potentially other classes) want to refer to timer queues regardless of the implementation internals.
typedef ACE_Timer_Queue_Iterator_T<TYPE> ACE_Abstract_Timer_Queue< TYPE >::ITERATOR 
Type of Iterator.

pure virtual 
Destructor.

pure virtual 
Determine the next event to timeout. Returns max if there are no pending timers or if all pending timers are longer than max. This method acquires a lock internally since it modifies internal state.
Implemented in ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
Determine the next event to timeout. Returns max if there are no pending timers or if all pending timers are longer than max. <the_timeout> should be a pointer to storage for the timeout value, and this value is also returned. This method does not acquire a lock internally since it doesn't modify internal state. If you need to call this method when the queue is being modified concurrently, however, you should make sure to acquire the <mutex()> externally before making the call.
Implemented in ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
Cancel all timer associated with type. If dont_call_handle_close is 0 then the <functor> will be invoked, which typically invokes the <handle_close> hook. Returns number of timers cancelled.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Cancel the single timer that matches the timer_id value (which was returned from the <schedule> method). If act is nonNULL then it will be set to point to the ``magic cookie'' argument passed in when the timer was registered. This makes it possible to free up the memory and avoid memory leaks. If dont_call_handle_close is 0 then the <functor> will be invoked, which typically calls the <handle_close> hook. Returns 1 if cancellation succeeded and 0 if the timer_id wasn't found.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Close timer queue. Cancels all timers.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Return the current time, using the right time policy and any timer skew defined in derived classes.
Implemented in ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
Dump the state of a object.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Returns the time of the earlier node in the Timer_Queue. Must be called on a nonempty queue.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Run the <functor> for all timers whose values are <= current_time. This does not account for <timer_skew>. Returns the number of timers canceled.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
Run the <functor> for all timers whose values are <= <ACE_OS::gettimeofday>. Also accounts for <timer_skew>.
Depending on the resolution of the underlying OS the system calls like select()/poll() might return at time different than that is specified in the timeout. Suppose the OS guarantees a resolution of t ms. The timeline will look like
A B   V V
———— t t t t t
If you specify a timeout value of A, then the timeout will not occur at A but at the next interval of the timer, which is later than that is expected. Similarly, if your timeout value is equal to B, then the timeout will occur at interval after B. Now depending upon the resolution of your timeouts and the accuracy of the timeouts needed for your application, you should set the value of <timer_skew>. In the above case, if you want the timeout A to fire no later than A, then you should specify your <timer_skew> to be A % t.
The timeout value should be specified via the macro ACE_TIMER_SKEW in your config.h file. The default value is zero.
Things get interesting if the t before the timeout value B is zero i.e your timeout is less than the interval. In that case, you are almost sure of not getting the desired timeout behaviour. Maybe you should look for a better OS :)
Returns the number of timers canceled.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
A couple of classes using Timer_Queues need to dispatch a single event at a time. But before they dispatch the event they need to release a lock, signal other threads, etc.
This member function should be used in that case. The additional operations to be called just before dispatching the event, and only if an event will be dispatched, are encapsulated in the ACE_Command_Base object.
Implemented in ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
Reads the earliest node from the queue and returns it.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Returns the current time of day. This method allows different implementations of the timer queue to use special high resolution timers.
Implemented in ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
Allows applications to control how the timer queue gets the time of day.
Implemented in ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.

pure virtual 
True if queue is empty, else false.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Returns a pointer to this ACE_Timer_Queue's iterator.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Removes the earliest node from the queue and returns it.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Resets the interval of the timer represented by timer_id to interval, which is specified in relative time to the current <gettimeofday>. If interval is equal to ACE_Time_Value::zero, the timer will become a nonrescheduling timer. Returns 0 if successful, 1 if not.
Implemented in ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY >, ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >.

pure virtual 
Schedule type that will expire at future_time, which is specified in absolute time. If it expires then act is passed in as the value to the <functor>. If interval is != to ACE_Time_Value::zero then it is used to reschedule the type automatically, using relative time to the current <gettimeofday>. This method returns a <timer_id> that uniquely identifies the the type entry in an internal list. This <timer_id> can be used to cancel the timer before it expires. The cancellation ensures that <timer_ids> are unique up to values of greater than 2 billion timers. As long as timers don't stay around longer than this there should be no problems with accidentally deleting the wrong timer. Returns 1 on failure (which is guaranteed never to be a valid <timer_id>).
Implemented in ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY >, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >.