Tuesday, 17 November 2009
The November 2009 mailing for the C++ Standards Committee was published last week. This is the post-meeting mailing for the October committee meeting and contains a new working draft incorporating all the proposals accepted at the October meeting.
As those of you who
Wong's blog will already know, the big news for concurrency is
that a proposal for
std::async has been
accepted, and this is reflected in the latest working
There are 5 concurrency-related papers (of which my name is on one), which I summarize below:
- N2985: C and C++ Thread Compatibility
Lawrence Crowl has been through the concurrency and multithreading support from the C++ working draft, and compared this to that now being added to the C working draft for the next C standard. This paper contains his observations and recommendations about the potential for compatibility between the types and functions provided by the two draft standards. I agree with some of his recommendations, and disagree with others. No action will be taken by the C++ committee unless his recommendations become full proposals.
- N2992: More Collected Issues with Atomics
This is Lawrence Crowl's paper which rounds up various issues with the C++ atomics. It was accepted by the committee, and has been incorporated into the working draft. The most noticeable change is that the atomic types and functions now live in the
<atomic>header. The macro for identifying lock-free atomics has been expanded into a set of macros, one per type, and a guarantee has been added that all instances of a type are lock-free, or all are not lock-free (rather than it being allowed to vary between objects). There is also a clarification that if you use compare-exchange operations on a type with padding bits then the padding bits will be part of the comparison (which will therefore affect
atomic<float>or similar), plus a few other clarifications.
- N2996: A Simple Asynchronous Call
This paper is by Herb Sutter and Lawrence Crowl, and brings together their papers from the pre-meeting mailing (N2970 and N2973) based on feedback from the committee. This is the
std::asyncproposal that got accepted, and which has been incorporated into the working draft.
The result is that we have a variadic
asyncfunction with an optional launch policy as the first argument, which specifies whether the function is to be spawned on a separate thread, deferred until
wait()is called on the returned
future, or either, at the choice of the implementation.
- N2997: Issues on Futures (Rev. 1)
This is a revision of N2967 from the pre-meeting mailing, which incorporates feedback from the committee. This is the version that was accepted, and which has been incorporated into the working draft. The key change is that
unique_futurehas been renamed to just
futurein order to make things easier to read in what is anticipated to be the common case.
- N2999: Background for issue 887: Clocks and Condition Variables (Rev. 1)
This is a minor revision of Detlef's paper from the pre-meeting mailing (N2969). The changes it proposes have not yet been accepted into the working paper, and will make it implementation-dependent which clocks can be used for condition variable waits.
Other concurrency changes in the working draft
std::mutexnow has a
constexprconstructor, so namespace-scope objects are guaranteed to be safe from initialization order issues.
- The return type of the
wait_untilmember functions of
std::condition_variable_anyhas been changed from a
cv_statusenum. This makes it clear whether the return is due to a signal (or spurious wake) or because the operation timed out.
implementation of the C++0x thread library will shortly be updated
to incorporate all these changes (including an implementation
std::async). Existing customers will get a free
upgrade as usual.