Boost logo

Boost :

Subject: Re: [boost] [c++std-parallel-2019] We need a coherent higher level parallelization story for C++ (was [thread] Is there a non-blocking future-destructor?)
From: Peter Dimov (pdimov_at_[hidden])
Date: 2015-10-14 10:54:03


Hartmut Kaiser wrote:

> FWIW, the design decision to let those (and only those) futures block on
> destruction which are returned from async was one of the really bad
> decisions made for C++11, however that's just my opinion (others agree,
> but yet others disagree).

I agree completely. The correct thing to do would have been to introduce a
separate class, I'll call it barrier here, although this is perhaps not
ideal, which takes care of lifetime issues by blocking in its destructor,
like this:

    X x;
    Y y;
    barrier b;
    auto f1 = async( b, [&]{ x.f( y, 1 ); } );
    auto f2 = async( b, [&]{ x.f( y, 2 ); } );


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