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

Function system_timer_move_test

test/system_timer.cpp:416–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416void system_timer_move_test()
417{
418 boost::asio::io_context io_context1;
419 boost::asio::io_context io_context2;
420 int count = 0;
421
422 boost::asio::system_timer t1 = make_timer(io_context1, &count);
423 boost::asio::system_timer t2 = make_timer(io_context2, &count);
424 boost::asio::system_timer t3 = std::move(t1);
425
426 t2 = std::move(t1);
427
428 io_context2.run();
429
430 BOOST_ASIO_CHECK(count == 1);
431
432 io_context1.run();
433
434 BOOST_ASIO_CHECK(count == 2);
435
436 boost::asio::system_timer t4 = make_convertible_timer(io_context1, &count);
437 boost::asio::system_timer t5 = make_convertible_timer(io_context2, &count);
438 boost::asio::system_timer t6 = std::move(t4);
439
440 t2 = std::move(t4);
441
442 io_context2.restart();
443 io_context2.run();
444
445 BOOST_ASIO_CHECK(count == 3);
446
447 io_context1.restart();
448 io_context1.run();
449
450 BOOST_ASIO_CHECK(count == 4);
451}
452
453void system_timer_op_cancel_test()
454{

Callers

nothing calls this directly

Calls 4

make_convertible_timerFunction · 0.85
restartMethod · 0.80
make_timerFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected