| ACE 6.0.4 | 
Adapts an ACE timer queue using a separate thread for dispatching. More...
#include <Timer_Queue_Adapters.h>


| Public Types | |
| typedef TQ | TIMER_QUEUE | 
| Trait for the underlying queue type. | |
| Public Member Functions | |
| ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager *=ACE_Thread_Manager::instance(), TQ *timer_queue=0) | |
| virtual | ~ACE_Thread_Timer_Queue_Adapter (void) | 
| Destructor. | |
| long | schedule (TYPE handler, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval=ACE_Time_Value::zero) | 
| int | cancel (long timer_id, const void **act=0) | 
| virtual int | svc (void) | 
| Runs the dispatching thread. | |
| virtual void | deactivate (void) | 
| Inform the dispatching thread that it should terminate. | |
| ACE_SYNCH_RECURSIVE_MUTEX & | mutex (void) | 
| Access the locking mechanism, useful for iteration. | |
| int | timer_queue (TQ *tq) | 
| Set a user-specified timer queue. | |
| TQ * | timer_queue (void) const | 
| Return the current <TQ>. | |
| ACE_thread_t | thr_id (void) const | 
| Return the thread id of our active object. | |
| virtual int | activate (long flags=THR_NEW_LWP|THR_JOINABLE, int n_threads=1, int force_active=0, long priority=ACE_DEFAULT_THREAD_PRIORITY, int grp_id=-1, ACE_Task_Base *task=0, ACE_hthread_t thread_handles[]=0, void *stack[]=0, size_t stack_size[]=0, ACE_thread_t thread_ids[]=0, const char *thr_name[]=0) | 
| Private Attributes | |
| TQ * | timer_queue_ | 
| The underlying Timer_Queue. | |
| bool | delete_timer_queue_ | 
| ACE_SYNCH_RECURSIVE_MUTEX | mutex_ | 
| ACE_SYNCH_RECURSIVE_CONDITION | condition_ | 
| bool | active_ | 
| ACE_thread_t | thr_id_ | 
| Thread id of our active object task. | |
Adapts an ACE timer queue using a separate thread for dispatching.
This implementation uses a separate thread to dispatch the timers. The base queue need not be thread safe; this class takes all the necessary locks.
| typedef TQ ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::TIMER_QUEUE | 
Trait for the underlying queue type.
| ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::ACE_Thread_Timer_Queue_Adapter | ( | ACE_Thread_Manager * | tm = ACE_Thread_Manager::instance (), | 
| TQ * | timer_queue = 0 | ||
| ) | 
Creates the timer queue. Activation of the task is the user's responsibility. Optionally a pointer to a timer queue can be passed, when no pointer is passed, a TQ is dynamically created
| ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::~ACE_Thread_Timer_Queue_Adapter | ( | void | ) |  [virtual] | 
Destructor.
| int ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::activate | ( | long | flags = THR_NEW_LWP | THR_JOINABLE, | 
| int | n_threads = 1, | ||
| int | force_active = 0, | ||
| long | priority = ACE_DEFAULT_THREAD_PRIORITY, | ||
| int | grp_id = -1, | ||
| ACE_Task_Base * | task = 0, | ||
| ACE_hthread_t | thread_handles[] = 0, | ||
| void * | stack[] = 0, | ||
| size_t | stack_size[] = 0, | ||
| ACE_thread_t | thread_ids[] = 0, | ||
| const char * | thr_name[] = 0 | ||
| ) |  [virtual] | 
We override the default activate() method so that we can ensure that only a single thread is ever spawned. Otherwise, too many weird things can happen...
Reimplemented from ACE_Task_Base.
| int ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::cancel | ( | long | timer_id, | 
| const void ** | act = 0 | ||
| ) | 
Cancel the timer_id and return the act parameter if an address is passed in. Also wakes up the dispatching thread.
| void ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::deactivate | ( | void | ) |  [virtual] | 
Inform the dispatching thread that it should terminate.
| ACE_SYNCH_RECURSIVE_MUTEX & ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::mutex | ( | void | ) | 
Access the locking mechanism, useful for iteration.
| long ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::schedule | ( | TYPE | handler, | 
| const void * | act, | ||
| const ACE_Time_Value & | future_time, | ||
| const ACE_Time_Value & | interval = ACE_Time_Value::zero | ||
| ) | 
Schedule the timer according to the semantics of the <TQ>; wakes up the dispatching thread.
| int ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::svc | ( | void | ) |  [virtual] | 
Runs the dispatching thread.
Reimplemented from ACE_Task_Base.
| ACE_thread_t ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::thr_id | ( | void | ) | const  [inline] | 
Return the thread id of our active object.
| int ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::timer_queue | ( | TQ * | tq | ) |  [inline] | 
Set a user-specified timer queue.
| TQ * ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::timer_queue | ( | void | ) | const  [inline] | 
Return the current <TQ>.
| bool ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::active_  [private] | 
When deactivate is called this variable turns to false and the dispatching thread is signalled, to terminate its main loop.
| ACE_SYNCH_RECURSIVE_CONDITION ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::condition_  [private] | 
The dispatching thread sleeps on this condition while waiting to dispatch the next timer; it is used to wake it up if there is a change on the timer queue.
| bool ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::delete_timer_queue_  [private] | 
Keeps track of whether we should delete the timer queue (if we didn't create it, then we don't delete it).
| ACE_SYNCH_RECURSIVE_MUTEX ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::mutex_  [private] | 
The mutual exclusion mechanism that is required to use the <condition_>.
| ACE_thread_t ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::thr_id_  [private] | 
Thread id of our active object task.
| TQ* ACE_Thread_Timer_Queue_Adapter< TQ, TYPE >::timer_queue_  [private] | 
The underlying Timer_Queue.
 1.7.4
 1.7.4