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

Function deadline_timer_cancel_test

test/deadline_timer.cpp:229–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229void deadline_timer_cancel_test()
230{
231 static boost::asio::io_context io_context;
232 struct timer
233 {
234 boost::asio::deadline_timer t;
235 timer() : t(io_context) { t.expires_at(boost::posix_time::pos_infin); }
236 } timers[50];
237
238 timers[2].t.async_wait(&timer_handler);
239 timers[41].t.async_wait(&timer_handler);
240 for (int i = 10; i < 20; ++i)
241 timers[i].t.async_wait(&timer_handler);
242
243 BOOST_ASIO_CHECK(timers[2].t.cancel() == 1);
244 BOOST_ASIO_CHECK(timers[41].t.cancel() == 1);
245 for (int i = 10; i < 20; ++i)
246 BOOST_ASIO_CHECK(timers[i].t.cancel() == 1);
247}
248
249struct custom_allocation_timer_handler
250{

Callers

nothing calls this directly

Calls 2

async_waitMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected