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

Function post_loop

test/co_composed.cpp:145–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144template <typename CompletionToken>
145auto post_loop(boost::asio::io_context& ctx, CompletionToken&& token)
146{
147 return boost::asio::async_initiate<CompletionToken, void(int)>(
148 boost::asio::co_composed(
149 [](auto state, boost::asio::io_context& ctx) -> void
150 {
151 int i = 0;
152 for (; i < 100; ++i)
153 co_await boost::asio::post(ctx, boost::asio::deferred);
154 co_yield state.complete(i);
155 }, ctx), token, std::ref(ctx));
156}
157
158void test_post_loop()
159{

Callers 1

test_post_loopFunction · 0.85

Calls 3

postFunction · 0.50
refClass · 0.50
completeMethod · 0.45

Tested by 1

test_post_loopFunction · 0.68