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

Function system_timer_thread_test

test/system_timer.cpp:369–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369void system_timer_thread_test()
370{
371 boost::asio::io_context ioc;
372 boost::asio::executor_work_guard<boost::asio::io_context::executor_type> work
373 = boost::asio::make_work_guard(ioc);
374 boost::asio::system_timer t1(ioc);
375 boost::asio::system_timer t2(ioc);
376 int count = 0;
377
378 boost::asio::detail::thread th(bindns::bind(io_context_run, &ioc));
379
380 t2.expires_after(boost::asio::chrono::seconds(2));
381 t2.wait();
382
383 t1.expires_after(boost::asio::chrono::seconds(2));
384 t1.async_wait(bindns::bind(increment, &count));
385
386 t2.expires_after(boost::asio::chrono::seconds(4));
387 t2.wait();
388
389 ioc.stop();
390 th.join();
391
392 BOOST_ASIO_CHECK(count == 1);
393}
394
395boost::asio::system_timer make_timer(boost::asio::io_context& ioc, int* count)
396{

Callers

nothing calls this directly

Calls 6

bindFunction · 0.50
expires_afterMethod · 0.45
waitMethod · 0.45
async_waitMethod · 0.45
stopMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected