3 #include "service_manager.h"
4 #include "../manes/kernel_state.h"
6 using namespace services
;
8 timer::timer() : service(SERVICE(timer
)) {
9 delegate
<void, int, delegate
<void> > *m_set_timer
= new delegate
<void, int, delegate
<void> >;
10 m_set_timer
->method(this,&timer::set_timer
);
11 add_method("set_timer",m_set_timer
);
14 void timer::set_timer(int wait
, delegate
<void> _call
) {
15 delegate
<void> ptr_time_tick
;
16 ptr_time_tick
.method(this,&timer::time_tick
);
19 start
= manes::kernel_state::get_instance()->get_time();
21 manes::kernel_state::get_instance()->add_time_tick_call(ptr_time_tick
);
24 void timer::time_tick() {
25 if (end
!= manes::kernel_state::get_instance()->get_time()) return;
27 delegate
<void> ptr_time_tick
;
28 ptr_time_tick
.method(this,&timer::time_tick
);
30 manes::kernel_state::get_instance()->del_time_tick_call(ptr_time_tick
);