summaryrefslogtreecommitdiff
path: root/ACE/apps/JAWS3/jaws3/Task_Timer.h
blob: a31781a922afcf778ba63acb3b5588e10579bbac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* -*- c++ -*- */
// $Id$

#ifndef JAWS_TASK_TIMER_H
#define JAWS_TASK_TIMER_H

#include "ace/Singleton.h"
#include "ace/Timer_Wheel.h"
#include "ace/Timer_Queue_Adapters.h"

#include "jaws3/Export.h"
#include "jaws3/Timer.h"

class JAWS_Task_Timer;

class JAWS_Export JAWS_Task_Timer : public JAWS_Timer_Impl
{
public:

  JAWS_Task_Timer (void);

  static JAWS_Timer_Impl * instance (void)
  {
    return ACE_Singleton<JAWS_Task_Timer, ACE_SYNCH_MUTEX>::instance ();
  }

  void schedule_timer ( long *timer_id
                      , const ACE_Time_Value &delta
                      , JAWS_Event_Completer *completer
                      , void *act = 0
                      );

  void schedule_absolute_timer ( long *timer_id
                               , const ACE_Time_Value &tv
                               , JAWS_Event_Completer *completer
                               , void *act = 0
                               );

  void schedule_interval_timer ( long *timer_id
                               , const ACE_Time_Value &interval
                               , JAWS_Event_Completer *completer
                               , void *act = 0
                               );

  void cancel_timer (long timer_id);
  // NOTE: Cancelling the timer causes handle_close to be called, but
  // not handle_timeout (of couse, I mean in the ACE_Event_Handler that
  // is being used as the timer helper).

private:

  ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Wheel> timer_queue_;

};

#endif /* JAWS_TASK_TIMER_H */