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

Method await_output

example/cpp11/timeouts/server.cpp:248–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246 }
247
248 void await_output()
249 {
250 auto self(shared_from_this());
251 non_empty_output_queue_.async_wait(
252 [this, self](const boost::system::error_code& /*error*/)
253 {
254 // Check if the session was stopped while the operation was pending.
255 if (stopped())
256 return;
257
258 if (output_queue_.empty())
259 {
260 // There are no messages that are ready to be sent. The actor goes
261 // to sleep by waiting on the non_empty_output_queue_ timer. When a
262 // new message is added, the timer will be modified and the actor
263 // will wake.
264 non_empty_output_queue_.expires_at(steady_timer::time_point::max());
265 await_output();
266 }
267 else
268 {
269 write_line();
270 }
271 });
272 }
273
274 void write_line()
275 {

Callers

nothing calls this directly

Calls 3

async_waitMethod · 0.45
emptyMethod · 0.45
expires_atMethod · 0.45

Tested by

no test coverage detected