Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::asio::deadline_timer destruction
From: Daniel (zin_corp_at_[hidden])
Date: 2013-04-19 12:07:10


Hello Igor,

Thank you for quick response.

But it requires of changing construction model. What if I want allocate objects at stack?

May be there are some technique which doesn't require from user to use shared_ptr technique? For example why boost::asio::deadline_timer::~deadline_timer doesn't wait completion of WaitHandler? Or is it bad way to wait smth in a destructor?

Thank you,
Daniel

> > I've noticed that WaitHandler can be called after
> > boost::asio::deadline_timer destruction. It may cause using of uninitialized
> > data. Are there any other solutions of graceful destruction of
> > boost::asio::deadline_timer to be sure that after this destruction
> > WaitHandler will never be called?
>
>
> Yes, the solution is to use shared_from_this idiom.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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