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

Function async_wait_twice

example/cpp14/deferred/deferred_4.cpp:17–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16template <typename CompletionToken>
17auto async_wait_twice(boost::asio::steady_timer& timer, CompletionToken&& token)
18{
19 return timer.async_wait(
20 deferred(
21 [&](boost::system::error_code ec)
22 {
23 std::cout << "first timer wait finished: " << ec.message() << "\n";
24 timer.expires_after(std::chrono::seconds(1));
25 return timer.async_wait(deferred);
26 }
27 )
28 )(
29 deferred(
30 [&](boost::system::error_code ec)
31 {
32 std::cout << "second timer wait finished: " << ec.message() << "\n";
33 return deferred.values(42);
34 }
35 )
36 )(
37 std::forward<CompletionToken>(token)
38 );
39}
40
41int main()
42{

Callers 1

mainFunction · 0.70

Calls 3

valuesMethod · 0.80
async_waitMethod · 0.45
expires_afterMethod · 0.45

Tested by

no test coverage detected