Boost logo

Boost :

Subject: Re: [boost] [next gen future-promise] What to call the monadicreturn type?
From: Avi Kivity (avi_at_[hidden])
Date: 2015-05-25 14:21:03


On 05/25/2015 09:04 PM, Peter Dimov wrote:
> Niall Douglas wrote:
>
>> I've got everything working except the sequence:
>>
>> promise<int> p;
>> p.set_value(5);
>> return p.get_future().get();
>>
>> This should reduce to a mov $5, %eax, but currently does not for an
>> unknown reason. I'm just about to go experiment and see why.
>
> I'm really struggling to see how all that could work. Where is the
> result stored? In the promise? Wouldn't this require the promise to
> outlive the future<>? This doesn't hold in general. How is it to be
> guaranteed?
>

In seastar, we achieved this by reserving space for the result in both
future and promise, and by having future and promise track each other
(so they can survive moves).

https://github.com/cloudius-systems/seastar/blob/master/core/future.hh


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