|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-05-30 10:25:01
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. :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk