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

Function coroutine_using_async_ops_1

test/spawn.cpp:289–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289int coroutine_using_async_ops_1(boost::asio::yield_context yield)
290{
291 using namespace archetypes;
292
293 try
294 {
295 int i = async_op_1(yield);
296 BOOST_ASIO_CHECK(i == 42);
297 }
298 catch (...)
299 {
300 BOOST_ASIO_CHECK(false);
301 }
302
303 try
304 {
305 int i = async_op_ec_1(true, yield);
306 BOOST_ASIO_CHECK(i == 42);
307 }
308 catch (...)
309 {
310 BOOST_ASIO_CHECK(false);
311 }
312
313 try
314 {
315 int i = async_op_ec_1(false, yield);
316 BOOST_ASIO_CHECK(false);
317 (void)i;
318 }
319 catch (boost::system::system_error& e)
320 {
321 BOOST_ASIO_CHECK(e.code() == boost::asio::error::operation_aborted);
322 }
323 catch (...)
324 {
325 BOOST_ASIO_CHECK(false);
326 }
327
328 try
329 {
330 int i = async_op_ex_1(true, yield);
331 BOOST_ASIO_CHECK(i == 42);
332 }
333 catch (...)
334 {
335 BOOST_ASIO_CHECK(false);
336 }
337
338 try
339 {
340 int i = async_op_ex_1(false, yield);
341 BOOST_ASIO_CHECK(false);
342 (void)i;
343 }
344 catch (std::exception& e)
345 {
346 BOOST_ASIO_CHECK(e.what() == std::string("blah"));

Callers

nothing calls this directly

Calls 5

async_op_1Function · 0.85
async_op_ec_1Function · 0.85
async_op_ex_1Function · 0.85
stringFunction · 0.85
codeMethod · 0.80

Tested by

no test coverage detected