Boost logo

Boost :

From: Braddock Gaskill (braddock_at_[hidden])
Date: 2008-04-13 19:20:53

On Fri, 11 Apr 2008 17:36:43 +0300, Peter Dimov wrote:
>>> pair<promise,future> pc = create_channel();
>> The thought crossed my mind, but there are too many places in real-world
>> usage (I've had a lot now) where I find I want to get a future from a
>> promise. I think it might be awkward to store both, and defeats the
>> intention of automatic cancelation.
> Can you please go into more detail?

Frank nailed it with the fire-and-forget example, but I did go back and
grep through my application code to see where I was deriving futures from

1) I converted a promise to future when I needed status functions like
ready() from the future. I've kept the promise interface pretty narrow.
So that usage could be changed if promise was made broader.

2) In my scheduler I had a "class task" object for each job which contained
a promise. The user could also hold a handle to this task object and get a
copy of the corresponding future. I suppose code like that could be
restructured if the extra constraint was justified.


Boost list run by bdawes at, gregod at, cpdaniel at, john at