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

Class impl_1_completion_arg

test/composed.cpp:122–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120//------------------------------------------------------------------------------
121
122class impl_1_completion_arg
123{
124public:
125 explicit impl_1_completion_arg(boost::asio::io_context& ioc)
126 : ioc_(ioc),
127 state_(starting)
128 {
129 }
130
131 template <typename Self>
132 void operator()(Self& self)
133 {
134 switch (state_)
135 {
136 case starting:
137 state_ = posting;
138 boost::asio::post(ioc_, static_cast<Self&&>(self));
139 break;
140 case posting:
141 self.complete(42);
142 break;
143 default:
144 break;
145 }
146 }
147
148private:
149 boost::asio::io_context& ioc_;
150 enum { starting, posting } state_;
151};
152
153template <typename CompletionToken>
154BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(int))

Callers 1

async_1_completion_argFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected