
30 May
2008
30 May
'08
2:25 p.m.
Johan Torp:
is_ready doesn't trigger the callback, so this won't work.
OTOH, I think is_ready should trigger the callback, even for the "run extra work in wait()" thread pool use case.
ready() should trigger a separate "ready callback", since its semantics are not the same. (f1 || f2).ready :- f1.ready || f2.ready (f1 || f2).wait :- wait_for_any(f1, f2) (Ignoring the problem in which f1 completes with an exception and f2 is still active.) Java futures don't have this callback proliferation problem because they are abstract. class future { public: virtual void wait() = 0; virtual bool ready() = 0; }; but we'd rather like to pass and return futures by value. :-)