Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-05-08 09:45:27


vicente.botet:
>>> I don't understand the need of this function. Could you show a use case
>>> for promise::get_future() function?
>>
>> promise::get_future() is the only way to get a future from a promise.
>> Since the whole point of using promise is to get the future, it's rather
>> pointless without it.
>
> why this is not an internal feautre?

You have to have a way to create the initial future, but for the "one time"
semantics one can have for example

    promise::promise( future& f );

instead of get_future.

FWIW, Braddock has argued (see the archives) that it's convenient to be able
to obtain a future from a promise, without the "one time" restriction.
("His" futures are "shared" though, as are "mine".) I argued that without
this feature, a promise can detect that no futures are left and can cancel
its task.


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