ACE 6.0.4
Public Types | Public Member Functions | Private Member Functions | Private Attributes
ACE_Async_Timer_Queue_Adapter< TQ, TYPE > Class Template Reference

Adapts an ACE timer queue to be driven asynchronously using signals. More...

#include <Timer_Queue_Adapters.h>

Inheritance diagram for ACE_Async_Timer_Queue_Adapter< TQ, TYPE >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Async_Timer_Queue_Adapter< TQ, TYPE >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef TQ TIMER_QUEUE

Public Member Functions

 ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask=0)
 Constructor.
long schedule (TYPE type, 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)
int expire (void)
TQ & timer_queue (void)
 Return a reference to the underlying timer queue.

Private Member Functions

virtual int schedule_ualarm (void)
 Perform the logic to compute the new ualarm(2) setting.
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *)
 Called back by SIGALRM handler.

Private Attributes

ACE_Sig_Handler sig_handler_
TQ timer_queue_
ACE_Sig_Set mask_
 Mask of signals to be blocked when we're servicing SIGALRM.

Detailed Description

template<class TQ, class TYPE = ACE_Event_Handler*>
class ACE_Async_Timer_Queue_Adapter< TQ, TYPE >

Adapts an ACE timer queue to be driven asynchronously using signals.

This implementation uses the ACE_OS::ualarm call, to generate the SIGARLM signal that is caught by this class.

Note:
This adapter only works on platforms that support ualarm(). POSIX platforms generally do; Windows and some others do not.
Todo:
This adapter does not automatically reschedule repeating timers.

Member Typedef Documentation

template<class TQ , class TYPE = ACE_Event_Handler*>
typedef TQ ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::TIMER_QUEUE

Constructor & Destructor Documentation

template<class TQ , class TYPE >
ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::ACE_Async_Timer_Queue_Adapter ( ACE_Sig_Set mask = 0)

Constructor.

Register the SIGALRM handler. If mask == 0 then block all signals when SIGALRM is run. Otherwise, just block the signals indicated in mask.


Member Function Documentation

template<class TQ , class TYPE >
int ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::cancel ( long  timer_id,
const void **  act = 0 
)

Cancel the timer_id and pass back the act if an address is passed in.

template<class TQ , class TYPE >
int ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::expire ( void  )

Dispatch all timers with expiry time at or before the current time. Returns the number of timers expired.

template<class TQ , class TYPE >
int ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::handle_signal ( int  signum,
siginfo_t ,
ucontext_t  
) [private, virtual]

Called back by SIGALRM handler.

Reimplemented from ACE_Event_Handler.

template<class TQ , class TYPE >
long ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::schedule ( TYPE  type,
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 ACE_Timer_List. This timer gets dispatched via a signal, rather than by a user calling expire(). Note that interval timers are not implemented yet.

template<class TQ , class TYPE >
int ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::schedule_ualarm ( void  ) [private, virtual]

Perform the logic to compute the new ualarm(2) setting.

template<class TQ , class TYPE >
TQ & ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::timer_queue ( void  )

Return a reference to the underlying timer queue.


Member Data Documentation

template<class TQ , class TYPE = ACE_Event_Handler*>
ACE_Sig_Set ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::mask_ [private]

Mask of signals to be blocked when we're servicing SIGALRM.

template<class TQ , class TYPE = ACE_Event_Handler*>
ACE_Sig_Handler ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::sig_handler_ [private]

Handler for the SIGALRM signal, so that we can access our state without requiring any global variables.

template<class TQ , class TYPE = ACE_Event_Handler*>
TQ ACE_Async_Timer_Queue_Adapter< TQ, TYPE >::timer_queue_ [private]

Implementation of the timer queue (e.g., ACE_Timer_List, ACE_Timer_Heap, etc.).


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines