Boost logo

Boost :

Subject: Re: [boost] Should pass boost::asio::io_service by raw pointer or smart pointer?
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2018-12-21 05:09:16


On Thu, Dec 20, 2018 at 8:37 PM hh h <jupiter.hce_at_[hidden]> wrote:
> It looks like a very good tutorial, but it used all shared pointer for
> io_services, deadline_timer, socket, io_service::strand,
> io_service::work and applications which contradicted to your comments,
> was it wrong or outdated or did I misinterpreted your following point?

It is both wrong, and outdated. Modern asio's executor_work_guard has
a member function reset() which releases the work. Probably the
shared_ptr in the examples used to manage the guard were written
before the reset() member was added. But there are other constructs in
that tutorial which are outdated.

I would look to the latest Asio examples and documentation for best
practices. And if you have specific questions don't hesitate to ask on
the list or open an issue in the relevant repository.

Regards


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