Wednesday, 08 September 2010
The August 2010 mailing for the C++ Standards Committee was published recently. This is the post-meeting mailing for the August 2010 committee meeting, and contains a new C++0x Working Draft. At the meeting in August, the committee discussed many of the National Body comments on the FCD, and this draft incorporates those changes that the committee approved of. As you can see from the FCD Comment Status document in this mailing, there were 301 technical comments and a further 215 editorial comments. Of these, 98 technical comments have been accepted as-is, 8 have been accepted with changes, and 63 have been rejected, leaving 132 technical comments that have still not been addressed one way or the other.
No significant changes have been accepted to the concurrency-related parts of the working draft, though there are quite a few editorial comments. However, there are several papers in this mailing that address the National Body comments in this area. These papers have by and large been drafted to represent the consensus of those members of the concurreny group in the LWG who were present at the meeting. I have summarised these papers below.
- N3113: Async Launch Policies (CH 36)
This paper provides a clearer basis for implementors to supply additional launch policies for
std::async, or for the committee to do so in a later revision of the C++ standard, by making the
std::launchenum a bitmask type. It also drops the
std::launch::anyenumeration value, and renames
std::launch::deferred, as this better describes what it means.
The use of a bitmask allows new values to be added which are either distinct values, or combinations of the others. The default policy for
- N3125: Omnibus Memory Model and Atomics Paper
This paper addresses several National Body comments by updating the wording in the draft standard to better reflect the intent of the committee.
- N3128: C++ Timeout Specification
There are several functions in the threading portion of the library that allow timeouts, such as the
try_lock_untilmember functions of the timed mutex types, and the
wait_untilmember functions of the future types. This paper clarifies what it means to wait for a specified duration (with the xxx
_forfunctions), and what it means to wait until a specified time point (with the xxx
_untilfunctions). In particular, it clarifies what can be expected of the implementation if the clock is changed during a wait.
This paper also proposes replacing the old
std::chrono::monotonic_clockwith a new
std::chrono::steady_clock. Whereas the only constraint on the monotonic clock was that it never went backwards, the steady clock cannot be adjusted, and always ticks at a uniform rate. This fulfils the original intent of the monotonic clock, but provides a clearer specification and name. It is also tied into the new wait specifications, since waiting for a duration requires a steady clock for use as a basis.
- N3129: Managing C++ Associated Asynchronous State
This paper tidies up the wording of the functions and classes related to the future types, and clarifies the management of the associated asynchronous state which is used to communicate e.g. between a
std::futurethat will receive the result.
- N3130: Lockable requirements for C++0x
This paper splits out the requirements for general lockable types away from the specific requirements on the standard mutex types. This allows the lockable concepts to be used to specify the requirements on a type to be used the the
std::unique_lockclass templates, as well as for the various overloads of the wait functions on
std::condition_variable_any, without imposing the precise behaviour of
std::mutexon user-defined mutex types.
- N3132: Mathematizing C++ Concurrency: The Post-Rapperswil Model
This paper provides a mathematical description for the C++0x memory model. A similar description was used to highlight some of the areas that are clarified by the omnibus memory model paper (N3125) described above.
- N3136: Coherence Requirements Detailed
This paper introduces some simple coherence requirements to the memory model wording to make it clear that the sequence of values read for a given variable must be consistent across threads. The existence of a single modification order for each variable is a key component of the memory model, and the wording introduced in this paper makes it clear that this is a core requirement.
- N3137: C and C++ Liaison: Compatibility for Atomics
The structure of the atomic types and operations in the FCD was carefully worked out in conjunction with the C standards committee to ensure that the C++0x atomic types were compatible with those being introduced in the upcoming C1x standard. Unfortunately, the C committee introduced a new incompatible syntax for atomic types into the C1x draft earlier this year because they believed it was a better match for the C language.
This paper attempts to address this new incompatibility by removing the
atomic_xxx types that were originally added for C compatibility, leaving just the
std::atomic<T>class template. Also, a new
_Atomic(T)macro is introduced for compatibility with the new C1x
As already mentioned, this mailing contains a new C++0x Working Draft, along with the usual post-meeting stuff — editors notes for the changes in the new draft, new issues lists, minutes of the meeting, etc. It also contains a complete list of the National Body Comments on the FCD, and a few other papers addressing National Body comments.
If you have any opinions on the resolution of any NB comments not yet formally accepted or rejected, please add them to the comments for this post.