Boost logo

Boost :

From: Johan Torp (johan.torp_at_[hidden])
Date: 2008-05-30 11:08:24

Anthony Williams-4 wrote:
>> No, (f1 || f2).ready != f1.ready || f2.ready.
>> f1 can be ready and false, in which case we need to wait for f2 to become
>> ready until the composite future is ready.
> What does it mean for a shared_future<string> to be "ready and false"?
> I view "f1 || f2" as a short-hand for a call to wait_for_any(f1,f2)
> followed by either f1.get() or f2.get() depending on which was ready
> first.

I was talking about future operators. That is the composite future we got
from f1 || f2, not selecting the first one which is ready. This should
become ready when it has an evaluated value of true or false.

Anthony Williams-4 wrote:
>>> Java futures don't have this callback proliferation problem because they
>>> are
>>> abstract.
>>> class future
>>> {
>>> public:
>>> virtual void wait() = 0;
>>> virtual bool ready() = 0;
>>> };
>> There are other ways of solving this too, without exposing callbacks.
> Can you suggest some?

I already have, all of my proposals has solved this without exposing any
external callbacks. I propose adding a parent-child relationship to futures
which is only exposed the wait for any/all mechanism. The
promise-fullfillers does not only notify their own condition, they traverse
their future's parents and notify them too.

The future-expressions can be built up with expressive templates or using
some sort of future collection. Read my other posts in the review request
thread and you should get an idea.


View this message in context:
Sent from the Boost - Dev mailing list archive at

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