Boost logo

Boost :

Subject: Re: [boost] Pondering Futures
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-01-08 15:41:06


"Tom Brinkman" <reportbase_at_[hidden]> writes:

> Ponderings on the Futures Library:
>
> What is the status of Anthony Williams' submission of the futures
> library to the c++ standards committee?

Futures have been approved by the committee. They are part of the
current working draft:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf

Futures are chapter 30.5

> Is a seperate library needed? What is the advantage of having a root
> level library called boost::futures?
> Why would it not be perferable to just extend boost::thread with the
> additional capabiltity to handle "futures"?

That was my intent. The presence of a separate futures library from
Braddock meant that it was more prudent to offer both libraries up for
review.

> Futures are a very useful concept, and I have used them personally.
> The c++ commitee is correctly considering
> adding them to the standard. I would be interested in hearing the
> authors views on their "grand" vision for
> parallel programming in general and how their "futures" library
> submissions fit into this vision.

Ooh, now you're asking!

My "grand" vision is that we will eventually have a C++ concurrency
library that allows users to divide their code into
potentially-parallelizable tasks and have the library manage the
actual parallelization. I also think that the fewer user-level locks
that are required the better.

I think futures are a useful concept for communicating values between
threads. They simplify communication because no explicit locking is
required in the user code. They also allow value-returning functions
to be run on other threads without the user having to explicitly
marshal the result (normal or exceptional) across the thread boundary.

Futures are also useful for thread pools --- you can submit a task to
a pool, and obtain a future which becomes ready when the task has
executed.

Anthony

-- 
Anthony Williams
Author of C++ Concurrency in Action | http://www.manning.com/williams
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Just Software Solutions Ltd, Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK

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