Boost logo

Boost Users :

Subject: Re: [Boost-users] Concurrency and session termination in boost::asio
From: Boris (boriss_at_[hidden])
Date: 2008-11-05 15:01:48


On Wed, 05 Nov 2008 20:39:47 +0100, Scott Gifford
<sgifford_at_[hidden]> wrote:

> [...]I rewrote it to have write errors handled by closing the session,
> which causes the read callback to run, notice the session has been
> closed, and delete the object. This seemed to solve the problem, but
> it still seems there is a potential problem if the read callback
> finishes deleting the object while the write callback is running.
>
> Is there a better way to handle session termination?

See the various Boost.Asio examples where classes with asynchronous
handlers are typically derived from boost::enable_shared_from_this.

Boris


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net