[cpp-threads] Re: Thread API interface tweaks
Nick Maclaren
nmm1 at cus.cam.ac.uk
Tue Aug 29 13:43:04 BST 2006
I am surprised that there are so many CCs, because I don't like them
on mailing lists. If most people do, I can try to remember to add
them, but will indubitably forget.
Kevlin Henney <kevlin at curbralan.com> wrote:
>
> This was not the particular usage I had in mind. Agreed, it does not
> appear to be massively useful, although it is plausible. However,
> banning things that are not massively useful but are plausible doesn't
> appear to be a necessity, and even seems a little harsh in this case.
> What I had in mind was the fact that multiple threads could wait for the
> completion of a thread based on a future<void>. Although it is an edge
> case, I reckon it would be more surprising to disallow future<void> than
> to allow it, and I reckon following the principle of least surprise
> would just tips the balance here.
Well, I can think of a fair number of uses for void futures, so it
would be more than just surprising if they are banned. For example:
A database or I/O system could spin off output, close or similar
operations with no interest in the result, except for success or
failure. That could be 'returned' either in a global variable or
by an exception. Also, the wait function could be a 'wait for all
futures on this list and stop the program'.
Now, you can reasonably say that this a poor programming style (I
don't agree, but it is a matter of taste), but it assuredly is a
common paradigm.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1 at cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
More information about the cpp-threads
mailing list