NAME

ACE_Timer_Queue

SYNOPSIS


#include <ace/Timer_Queue.h>


class ACE_Timer_Queue
{
  public:
    ACE_Timer_Queue (void);
    virtual ~ACE_Timer_Queue (void);
    int is_empty (void) const;
    const ACE_Time_Value &earliest_time (void) const;
    int schedule (
        ACE_Event_Handler *event_handler,
        const void *arg,
        const ACE_Time_Value &delay,
        const ACE_Time_Value &interval = ACE_Time_Value::zero
        );
    int cancel (ACE_Event_Handler *event_handler);
    int cancel (int timer_id, const void **arg = 0);
    int expire (const ACE_Time_Value &current_time);
    ACE_Time_Value *calculate_timeout (ACE_Time_Value *max);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  private:
    ACE_Time_Value timeout_;
    void reschedule (ACE_Timer_Node *);
    ACE_Timer_Node *head_;
    int timer_id_;
    ACE_Recursive_Thread_Mutex lock_;
};

DESCRIPTION

This is a simple implementation that uses a linked list of absolute times. A more clever implementation would use a delta-list, a heap, or timing wheels.

Initialization and termination methods.

ACE_Timer_Queue (void);
virtual ~ACE_Timer_Queue (void);
int is_empty (void) const;
const ACE_Time_Value &earliest_time (void) const;
int schedule (
    ACE_Event_Handler *event_handler,
    const void *arg,
    const ACE_Time_Value &delay,
    const ACE_Time_Value &interval = ACE_Time_Value::zero
    );
int cancel (ACE_Event_Handler *event_handler);
int cancel (int timer_id, const void **arg = 0);
int expire (const ACE_Time_Value &current_time);
ACE_Time_Value *calculate_timeout (ACE_Time_Value *max);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;

AUTHOR

Doug Schmidt

TITLE

Provides an interface to timers.

LIBRARY

ace