MCPcopy Create free account
hub / github.com/Stiffstream/restinio / processing_thread_func

Function processing_thread_func

dev/sample/async_chained_handlers/main.cpp:259–277  ·  view source on GitHub ↗

Thread for final request processing operations.

Source from the content-addressed store, hash-verified

257
258// Thread for final request processing operations.
259void processing_thread_func( const so_5::mchain_t& req_ch )
260{
261 // This flag will be set to 'true' when some of channels will be closed.
262 bool stop = false;
263 receive(
264 so_5::from( req_ch ).handle_all()
265 // If some channel become closed we should set out 'stop' flag.
266 .on_close( [&stop](const auto &) { stop = true; } )
267 // A predicate for stopping receive() function.
268 .stop_on( [&stop]{ return stop; } ),
269
270 // The handler of incoming request.
271 [router = create_request_handler()]
272 ( so_5::mutable_mhood_t<do_processing> cmd ) {
273 // Just call an actual router for request processing.
274 // All futher processing will be performed synchronously.
275 std::ignore = (*router)(cmd->m_controller->request_handle());
276 });
277}
278
279int main()
280{

Callers

nothing calls this directly

Calls 1

create_request_handlerFunction · 0.70

Tested by

no test coverage detected