[cpp-threads] Asynchronous Function Proposal

Peter Dimov pdimov at mmltd.net
Mon Jun 1 14:48:31 BST 2009


> Please take a look at the attacked draft proposal for the async function. 
> Comments are encouraged.

I do not agree with your choice of (only) providing a policy that executes 
on get(), neither do I agree with the choice to remove wait, has_value and 
has_exception because of it. Furthermore, the name "must_be_called" does not 
make sense for this policy, because it in fact never calls the function 
unless there is a get() call.

The sensible policies are (in my opinion):

- at implementation's discretion (default)
- launch in a thread pool
- launch in a separate thread
- execute immediately (for generic contexts)
- defer until wait() is called (not get)

I think that an enum parameter may be better as a policy because it would 
allow the choice to be made at runtime.

In principle, there is no need to remove is_ready; it can be made to always 
return false for the separate thread case until wait is called. A dedicated 
implementation can even make it work. 




More information about the cpp-threads mailing list