Boost logo

Boost :

Subject: Re: [boost] Executor associated to the future continuations (was [thread] boost::future::then)
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2015-10-30 13:28:26


Le 30/10/15 13:42, Vladimir Prus a écrit :
> On 30-Oct-15 10:08 AM, Vladimir Prus wrote:
>
>
> BTW, I've noticed that if I call boost::future::get() twice in my
> continuation, on the same future object,
> the second call throws, saying:
>
> Operation not permitted on an object without an associated state
>
> you can find the example at:
>
> https://gist.github.com/vprus/d53ef0860608b856aa60
>
> Am I missing something? Looking at both std::future and boost::future
> documentation, I see no indication
> that calling get clears the state.
>
No. a future moves itself to the continuation so you can not associate
twice a continuation. You need to use shared_future.

Please, create a ticket. I will look for where this is said, and try to
be more explicit so that the next one doesn't miss the specificity. The
major difference between future and shared_future is that, you can get
only once the value.

Vicente


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