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

Function bind_executor_to_function_object_test

test/bind_executor.cpp:35–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void bind_executor_to_function_object_test()
36{
37 io_context ioc1;
38 io_context ioc2;
39
40 int count = 0;
41
42 timer t(ioc1, chronons::seconds(1));
43 t.async_wait(
44 bind_executor(
45 ioc2.get_executor(),
46 bindns::bind(&increment, &count)));
47
48 ioc1.run();
49
50 BOOST_ASIO_CHECK(count == 0);
51
52 ioc2.run();
53
54 BOOST_ASIO_CHECK(count == 1);
55
56 t.async_wait(
57 bind_executor(
58 ioc2.get_executor(),
59 bind_executor(
60 boost::asio::inline_executor(),
61 bindns::bind(&increment, &count))));
62
63 ioc1.restart();
64 ioc1.run();
65
66 BOOST_ASIO_CHECK(count == 1);
67
68 ioc2.restart();
69 ioc2.run();
70
71 BOOST_ASIO_CHECK(count == 2);
72}
73
74struct incrementer_token_v1
75{

Callers

nothing calls this directly

Calls 5

restartMethod · 0.80
bindFunction · 0.50
async_waitMethod · 0.45
get_executorMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected