The code means:

boost::asio::require(                                  // #3
    io_context->get_executor(),                        // #1
    boost::asio::execution::outstanding_work.tracked)  // #2

#1: given this executor,
#2: try to construct a similar executor which tracks the outstanding io operations associated with it (i.e. does not stop until all work is complete)
#3: require that this tracking attribute is available (fail to compile if the executor does not support it)




On Sun, 6 Jun 2021 at 17:13, ZheNing Hu via Boost-users <boost-users@lists.boost.org> wrote:
Hi, I ran into difficulties when I was reading boost::asio http server
example[1],

I see:

    work_.push_back(
        boost::asio::require(io_context->get_executor(),
                             boost::asio::execution::outstanding_work.tracked));

I don't know what is the meaning of this code?
Or what is boost::asio::require()? I did not find useful information
to introduce it.

[1] https://www.boost.org/doc/libs/1_76_0/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.cpp

--
ZheNing Hu
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users