Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2007-03-12 18:09:27


On Mon, 12 Mar 2007 17:25:27 -0400, "Frank Mori Hess"
<frank.hess_at_[hidden]> said:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Monday 12 March 2007 17:12 pm, Braddock Gaskill wrote:
> > A weakness in the future<> concept, as I understand it, is that if a
> > future is never set(), then the invoking thread can hang waiting for it.
> > Not very RAII.
> >
> > The situation is much improved if future<T> and promise<T> are split,
> > and promise<T> is reference counted. If the last promise<T> for a
> > particular future<T> goes out of scope, than any thread waiting on the
> > matching future<T> would be failed with a promise_broken exception or
> > somesuch.
> >
> > Is this already part of the promise<T> concept?
>
> No, at least it wasn't in the code Chris posted. I like the idea though,
> thanks. I'm going to incorporate it into my code.

I agree, it's an excellent idea. I think it would be more idiomatic to
name the exception "broken_promise" though :)

Cheers,
Chris


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