void simple (ACE_Timer_Queue &timer_queue) { int events = 0; int result = 0; long timer_id = -1; { Simple_Event_Handler *handler = new Simple_Event_Handler; timer_id = timer_queue.schedule (handler, one_second_timeout, ACE_Time_Value (1) + timer_queue.gettimeofday (), ACE_Time_Value (1)); ACE_ASSERT (timer_id != -1); result = timer_queue.cancel (timer_id, 0, 0); ACE_ASSERT (result == 1); } { Simple_Event_Handler *handler = new Simple_Event_Handler; timer_id = timer_queue.schedule (handler, one_second_timeout, ACE_Time_Value (1) + timer_queue.gettimeofday (), ACE_Time_Value (1)); ACE_ASSERT (timer_id != -1); events += 3; } for (int i = 0; i < events;) { WAIT_FOR_NEXT_EVENT (timer_queue); result = timer_queue.expire (); ACE_ASSERT (result >= 0); i += result; } timer_queue.cancel (timer_id, 0, 0); }
int invoke_expire (ACE_Timer_Queue &timer_queue) { return timer_queue.expire (); }