MCPcopy Create free account
hub / github.com/boostorg/cobalt / run_server

Function run_server

example/echo_server.cpp:55–65  ·  view source on GitHub ↗

tag::run_server[]

Source from the content-addressed store, hash-verified

53
54// tag::run_server[]
55cobalt::promise<void> run_server(cobalt::wait_group & workers)
56{
57 auto l = listen(); // <1>
58 while (true)
59 {
60 if (workers.size() == 10u)
61 co_await workers.wait_one(); // <2>
62 else
63 workers.push_back(echo(co_await l)); // <3>
64 }
65}
66// end::run_server[]
67
68// tag::main[]

Callers

nothing calls this directly

Calls 5

listenFunction · 0.85
echoFunction · 0.85
wait_oneMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected