Boost logo

Boost :

Subject: Re: [boost] [thread] terminating destructor
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-10-13 16:39:17


on Sat Oct 13 2012, Andrzej Krzemienski <akrzemi1-AT-gmail.com> wrote:

> Then I referred to paper N3451 ("async and ~future"):
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3451.pdf
> Herb Sutter observes that because future's destructor blocks, the following
> code:
>
> {
> async( []{ f(); } );
> async( []{ g(); } );
> }
>
> surprisingly, is executed synchronously (i.e., we do not launch the task
> executing g() until the task executing f() has finished). He proposes a
> change to std::future to detach in destructor. I just mention it because if
> boost::future tries to follow std::future, this may become necessary one
> day.

Just so you know, that paper is already controversial in the committee
mailing lists. It will be interesting to see where consensus eventually
settles, but at this point I wouldn't bet on any particular outcome.

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

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