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

Function compose_0_completion_args_test

test/compose.cpp:84–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82};
83
84void compose_0_completion_args_test()
85{
86 namespace bindns = std;
87
88 boost::asio::io_context ioc;
89 int count = 0;
90
91 async_0_completion_args(ioc, bindns::bind(&compose_0_args_handler, &count));
92
93 // No handlers can be called until run() is called.
94 BOOST_ASIO_CHECK(!ioc.stopped());
95 BOOST_ASIO_CHECK(count == 0);
96
97 ioc.run();
98
99 // The run() call will not return until all work has finished.
100 BOOST_ASIO_CHECK(ioc.stopped());
101 BOOST_ASIO_CHECK(count == 1);
102
103 ioc.restart();
104 count = 0;
105
106 compose_0_args_lvalue_handler lvalue_handler = { &count };
107 async_0_completion_args(ioc, lvalue_handler);
108
109 // No handlers can be called until run() is called.
110 BOOST_ASIO_CHECK(!ioc.stopped());
111 BOOST_ASIO_CHECK(count == 0);
112
113 ioc.run();
114
115 // The run() call will not return until all work has finished.
116 BOOST_ASIO_CHECK(ioc.stopped());
117 BOOST_ASIO_CHECK(count == 1);
118}
119
120//------------------------------------------------------------------------------
121

Callers

nothing calls this directly

Calls 5

restartMethod · 0.80
async_0_completion_argsFunction · 0.70
bindFunction · 0.50
stoppedMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected