1 #include "PTimerDispatcher.h"
3 void PTimer_Dispatcher::wait_for_event ()
5 ACE_TRACE ("PTimer_Dispatcher::wait_for_event");
9 ACE_Time_Value max_tv
= timer_queue_
->gettimeofday ();
11 ACE_Time_Value
*this_timeout
=
12 this->timer_queue_
->calculate_timeout (&max_tv
);
14 if (*this_timeout
== ACE_Time_Value::zero
)
15 this->timer_queue_
->expire ();
18 // Convert to absolute time.
19 ACE_Time_Value next_timeout
=
20 timer_queue_
->gettimeofday ();
21 next_timeout
+= *this_timeout
;
22 if (this->timer_
.wait (&next_timeout
) == -1 )
23 this->timer_queue_
->expire ();
29 PTimer_Dispatcher::schedule (PCB
*cb
,
31 const ACE_Time_Value
&abs_time
,
32 const ACE_Time_Value
&interval
)
34 ACE_TRACE ("PTimer_Dispatcher::schedule_timer");
36 return this->timer_queue_
->schedule
37 (cb
, arg
, abs_time
, interval
);
41 PTimer_Dispatcher::cancel (PCB
*cb
,
42 int dont_call_handle_close
)
44 ACE_TRACE ("PTimer_Dispatcher::cancel");
45 return timer_queue_
->cancel (cb
, dont_call_handle_close
);
48 void PTimer_Dispatcher::set (PTimerQueue
*timer_queue
)
50 ACE_TRACE ("PTimer_Dispatcher::set");
52 timer_queue_
= timer_queue
;
56 PTimer_Dispatcher::reset_interval (long timer_id
,
57 const ACE_Time_Value
&interval
)
59 ACE_TRACE ("PTimer_Dispatcher::reset_interval");
61 return timer_queue_
->reset_interval (timer_id
, interval
);
63 ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton
, PTimer_Dispatcher
, ACE_Null_Mutex
);