Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2021-01-07 20:22:13


On 1/7/21 4:51 PM, Thomas Goirand via Boost wrote:
> Hi,
>
> I'm the Debian package maintainer for Ceph. Ceph currently fails to
> build with latest libbost. Here's the build log:
>
> /root/ceph/src/common/async/completion.h:194:29: error:
> 'boost::asio::executor_work_guard<boost::asio::execution::any_executor<
>>> '} has no member named 'defer'; did you mean 'prefer'?
> 194 | w.second.get_executor().defer(std::move(f), alloc2);
>
> and 3 more like this. The code doing this is in
> src/common/async/completion.h:
>
> void destroy_defer(std::tuple<Args...>&& args) override {
> auto w = std::move(work);
> auto f = bind_and_forward(std::move(handler), std::move(args));
> RebindAlloc2 alloc2 = boost::asio::get_associated_allocator(handler);
> RebindTraits2::destroy(alloc2, this);
> RebindTraits2::deallocate(alloc2, this, 1);
> w.second.get_executor().defer(std::move(f), alloc2);
> }
>
> Has the boost API changed? If so, how to fix the above code?

This seems to be caused by some changes in Boost.ASIO, in particular its
executors API. I'm not the maintainer and I have no knowledge of that
part of Boost.ASIO, but you could try using the standalone defer algorithm.

Instead of:

   w.second.get_executor().defer(std::move(f), alloc2);

try:

   boost::asio::defer(w.second.get_executor(), std::move(f));

You will need to add #include <boost/asio/defer.hpp> for this.

Note: the above is completely untested.

You may want to ask for help regarding ASIO on its GitHub project
(https://github.com/chriskohlhoff/asio/). Boost.ASIO is auto-generated
from ASIO and has the same API sans namespaces and macro names.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk