5 #include "ace/OS_NS_sys_time.h"
7 #include "jaws3/Task_Timer.h"
8 #include "jaws3/Timer_Helpers.h"
11 JAWS_Task_Timer::JAWS_Task_Timer ()
13 this->timer_queue_
.activate ();
18 JAWS_Task_Timer::schedule_timer ( long *timer_id
19 , const ACE_Time_Value
&delta
20 , JAWS_Event_Completer
*completer
24 JAWS_Timer_EH
*eh
= new JAWS_Timer_EH (completer
, act
);
27 this->timer_queue_
.schedule ( eh
29 , delta
+ ACE_OS::gettimeofday ()))
32 JAWS_Event_Result
timer_result ( 0
33 , JAWS_Event_Result::JE_ERROR
34 , JAWS_Event_Result::JE_TIMER_FAIL
38 completer
->timer_complete (timer_result
, act
);
46 JAWS_Task_Timer::schedule_absolute_timer ( long *timer_id
47 , const ACE_Time_Value
&tv
48 , JAWS_Event_Completer
*completer
52 JAWS_Timer_EH
*eh
= new JAWS_Timer_EH (completer
, act
);
54 || (*timer_id
= this->timer_queue_
.schedule (eh
, 0, tv
)) == -1)
56 JAWS_Event_Result
timer_result ( 0
57 , JAWS_Event_Result::JE_ERROR
58 , JAWS_Event_Result::JE_TIMER_FAIL
62 completer
->timer_complete (timer_result
, act
);
70 JAWS_Task_Timer::schedule_interval_timer ( long *timer_id
71 , const ACE_Time_Value
&interval
72 , JAWS_Event_Completer
*completer
76 JAWS_Timer_EH
*eh
= new JAWS_Timer_EH (completer
, act
);
79 this->timer_queue_
.schedule ( eh
81 , interval
+ ACE_OS::gettimeofday ()
86 JAWS_Event_Result
timer_result ( 0
87 , JAWS_Event_Result::JE_ERROR
88 , JAWS_Event_Result::JE_TIMER_FAIL
92 completer
->timer_complete (timer_result
, act
);
100 JAWS_Task_Timer::cancel_timer (long timer_id
)
102 this->timer_queue_
.cancel (timer_id
);