MCPcopy Create free account
hub / github.com/boostorg/asio / system_timer_cancel_test

Function system_timer_cancel_test

test/system_timer.cpp:233–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231};
232
233void system_timer_cancel_test()
234{
235 static boost::asio::io_context io_context;
236 struct timer
237 {
238 boost::asio::system_timer t;
239 timer() : t(io_context)
240 {
241 t.expires_at((boost::asio::system_timer::time_point::max)());
242 }
243 } timers[50];
244
245 timers[2].t.async_wait(timer_handler());
246 timers[41].t.async_wait(timer_handler());
247 for (int i = 10; i < 20; ++i)
248 timers[i].t.async_wait(timer_handler());
249
250 BOOST_ASIO_CHECK(timers[2].t.cancel() == 1);
251 BOOST_ASIO_CHECK(timers[41].t.cancel() == 1);
252 for (int i = 10; i < 20; ++i)
253 BOOST_ASIO_CHECK(timers[i].t.cancel() == 1);
254}
255
256struct custom_allocation_timer_handler
257{

Callers

nothing calls this directly

Calls 3

timer_handlerClass · 0.70
async_waitMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected