Boost logo

Boost :

From: Hess, Frank (frank.hess_at_[hidden])
Date: 2007-03-12 14:36:27

> -----Original Message-----
> From: boost-bounces_at_[hidden]
> On Behalf Of Christopher Kohlhoff

> I've attached a quick and dirty futures implementation that I wrote
> year to demonstrate how futures and asio might fit together. Unlike
> various futures proposals that are around, I prefer to keep the
> and consumer interfaces separate. Hence I have promise<T> (producer
> interface) and future<T> (consumer interface) -- these names are
> borrowed from the Alice programming language.

Splitting promise from future seems like a good idea, it should make the
future class in libpoet a little less confusing. One thing your code
reminded me of is forwarding exceptions to the future, something I put
off then completely forgot about in libpoet. Since I'm trying to
provide an active function object that wraps an ordinary passive
function, for the general case I would need to call something like your
promise::fail() from a catch block that catches exceptions thrown by the
passive function. Unfortunately, that would require something like a
templated catch. It seems the best I can do is provide special handling
for some particular type of exception, like a
boost::shared_ptr<std::exception> and if the passive function throws
anything else, it just gets forwarded to the future as something like a


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