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

Function main

example/cpp11/futures/daytime_client.cpp:67–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67int main(int argc, char* argv[])
68{
69 try
70 {
71 if (argc != 2)
72 {
73 std::cerr << "Usage: daytime_client <host>" << std::endl;
74 return 1;
75 }
76
77 // We run the io_context off in its own thread so that it operates
78 // completely asynchronously with respect to the rest of the program.
79 boost::asio::io_context io_context;
80 auto work = boost::asio::make_work_guard(io_context);
81 std::thread thread([&io_context](){ io_context.run(); });
82
83 get_daytime(io_context, argv[1]);
84
85 io_context.stop();
86 thread.join();
87 }
88 catch (std::exception& e)
89 {
90 std::cerr << e.what() << std::endl;
91 }
92
93 return 0;
94}

Callers

nothing calls this directly

Calls 4

get_daytimeFunction · 0.85
runMethod · 0.45
stopMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected