#include <Timer_Queue_Adapters.h>
Inheritance diagram for ACE_Thread_Timer_Queue_Adapter
Public Types | |
typedef TQ | TIMER_QUEUE |
Trait for the underlying queue type. | |
Public Methods | |
ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager * = ACE_Thread_Manager::instance ()) | |
Creates the timer queue. Activation of the task is the user's responsibility. | |
long | schedule (ACE_Event_Handler *handler, const void *act, const ACE_Time_Value &delay, 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 | cancel (long timer_id, const void **act = 0) |
Cancel the <timer_id> add return the parameter if an address is passed in. Also wakes up the dispatching thread. | |
virtual int | svc (void) |
Runs the dispatching thread. | |
virtual void | deactivate (void) |
Inform the dispatching thread that it should terminate. | |
ACE_SYNCH_MUTEX& | mutex (void) |
Access the locking mechanism, useful for iteration. | |
TQ& | timer_queue (void) |
Access the implementation queue, useful for iteration. | |
ACE_thread_t | thr_id (void) |
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_names[] = 0) |
Private Attributes | |
TQ | timer_queue_ |
The underlying Timer_Queue. | |
ACE_SYNCH_CONDITION | condition_ |
ACE_SYNCH_MUTEX | mutex_ |
The mutual exclusion mechanism which is required to use the <condition_>. | |
int | active_ |
When deactivate is called this variable turns to false and the dispatching thread is signalled, to terminate its main loop. | |
ACE_thread_t | thr_id_ |
Thread id of our active object task. |
This implementation of a Timer_Queue uses a separate thread to dispatch the timers. The base queue need not be thread safe, this class takes all the necessary locks.
|
Trait for the underlying queue type.
|
|
Creates the timer queue. Activation of the task is the user's responsibility.
|
|
We override the default 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. |
|
Cancel the <timer_id> add return the parameter if an address is passed in. Also wakes up the dispatching thread.
|
|
Inform the dispatching thread that it should terminate.
|
|
Access the locking mechanism, useful for iteration.
|
|
Schedule the timer according to the semantics of the <TQ>; wakes up the dispatching thread.
|
|
Runs the dispatching thread.
Reimplemented from ACE_Task_Base. |
|
Return the thread id of our active object.
|
|
Access the implementation queue, useful for iteration.
|
|
When deactivate is called this variable turns to false and the dispatching thread is signalled, to terminate its main loop.
|
|
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. |
|
The mutual exclusion mechanism which is required to use the <condition_>.
|
|
Thread id of our active object task.
|
|
The underlying Timer_Queue.
|