ACCU 2013 and the C++ Standards Meeting

Monday, 06 May 2013

This year's ACCU conference was at a new venue: the Marriott hotel in Bristol. This is a bit closer to home for me than the previous venue in Oxford, which made the trip there and back more comfortable. As ever, the conference itself was enjoyable, educational and exhausting in equal measure.

This year was also BSI's turn to host the Spring ISO C++ committee meeting, which was conveniently arranged to be the week following ACCU, in the same hotel. Having not attended a meeting since the last time the committee met in the UK, I was glad to be able to attend this too.

ACCU 2013

As usual, with 5 tracks running simultaneously, it was hard to choose which sessions to attend. I stuck mostly to C++-centric, or general software development sessions, but there were also sessions on a wide range of other topics, including Ruby, Java, Scala, Git, C#, testing, management and culture, amongst others.

I was invited to contribute to Pete Goodliffe's Becoming a Better Programmer panel session, which was well attended and entertaining, as usual for Pete's sessions. My contribution on "doing things mindfully" seemed well-received, but wasn't the most popular — that honour went to Seb Rose, though Brian Marick called out Anna-Jayne Metcalfe's contribution on "If it ain't broke, do fix it" in the keynote the next morning.

My presentation on "C++11 in the Real World" was also well attended, with some good questions from the audience. A couple of people have asked me for my slides: they are available from the ACCU website.

ISO C++ committee meeting

This was a landmark meeting, for several reasons. Firstly, there were over 100 attendees, making it one of the most well-attended ISO C++ meetings ever. Secondly, this bumper attendee count was complemented by a bumper batch of proposals and position papers to process, which meant that all the working groups were pressed for time, and people met for extra sessions in the evenings to try and get through them all. Finally, the committee voted to publish a new "CD", starting the formal process leading to a C++14 standard.

The meeting was 6 days long, but I was only able to attend for the first 2 days. Unsurprisingly, I spent my time in the Concurrency group (SG1). We had a lot of papers to discuss, and some of the discussions were quite involved. Ultimately, not many papers were forwarded to the full committee, and only one paper other than the basic defect-report fixes was approved.

Lawrence Crowl's paper on Stream Mutexes (N3535) was first up. The problem this paper is trying to address is ensuring that data written to a stream from multiple threads appears in a coherent order — though concurrent writes to e.g. std::cout are guaranteed not to yield undefined behaviour, the output may be interleaved in an arbitrary fashion. This got quite a bit of discussion over the course of the week, and was eventually submitted as a much-modified paper for writing chunks to a stream in an atomic fashion, which was voted down in full committee.

Herb Sutter's late paper on the behaviour of the destructor of std::future (N3630) was up next. This is a highly conterversial topic, and yielded much discussion. The crux of the matter is that as currently specified the destructor of std::future blocks if it came from an invocation of std::async, the asynchronous function was run on a separate thread (with the std::launch::async policy), and that thread has not yet finished. This is highly desirable in many circumstances, but Herb argued that there are other circumstances where it is less desirable, and this makes it hard to use std::future in some types of program.

Much of the discussion focused on the potential for breaking existing code, and ways of preventing this. The proposal eventually morphed into a new paper (N3637) which created 2 new types of future: waiting_future and shared_waiting_future. std::async would then be changed to return a waiting_future instead of a future. Existing code that compiled unchanged would then keep the existing behaviour; code that changed behaviour would fail to compile. Though the change required to get the desired behaviour would not be extensive, the feeling in the full committee was that this breakage would be too extensive, and the paper was also voted down in full committee.

Herb's original paper also included a change to the destructor of std::thread, so that the destructor of a joinable thread would call join() rather than std::terminate(). This was put up for vote as N3636, but again was voted down in full committee.

Like I said, there were lots of other papers up for discussion. Some were concrete proposals, whilst others were less complete, asking for feedback on the approach. Only one paper was approved for the C++14 time frame — whilst there was considerable interest in the idea behind some of the others, there was disagreement about the details, and nothing else was deemed ready. I look forward to seeing the revised versions of some of these proposals when they are ready, especially the executors, continuations and parallel algorithms papers.

The paper that did get approved was Howard Hinnant's paper on shared locking (N3568), but even that didn't go through unchanged. I have serious concerns about the upgrade_mutex proposed in the original paper, and while I didn't manage to get my concerns across via email (this was discussed after I left), there was not enough interest in including it in C++14. The approved paper (N3659) therefore included only shared_mutex and shared_lock, not upgrade_mutex, which is good. N3659 was also approved by the vote in full committee, so will be part of C++14.

Wrap up

Having the conference and ISO meeting back-to-back was intense, but I thoroughly enjoyed attending both. C++14 looks set to be a significant improvement over C++11 — though the individual changes are minor, they offer quite a bit in terms of improved usability of the language and library. See the trip reports by Herb Sutter and Michael Wong (part 2, part 3) for more details on the accepted papers.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

9 Comments

Nice trip report! I like how you, very shortly and to the point, walk through the papers one by one. When the committee votes down a proposal like N3535, is their motivation for that available for read somewhere?

by TommyS at 05:45:23 on Tuesday, 07 May 2013

Hi

Could you explain why you think upgradable mutex is not a good idea in the end? I'm using two instances of boost ones in my current (game) application which uses TBB and boost for multithreading. I have no idea what might be the problem with upgradable mutex, so could you clarify so that I can decide if I should keep the related code?

by Joel Lamotte at 17:06:05 on Tuesday, 07 May 2013

@Tommy: The rationale is not currently publicly available. It might be in the minutes when they are published, but I can't remember how detailed the public ones get. I know there was concern about complexity and implementation overhead, but I was not present for the full discussion.

@Joel: I think that most of the time a need for an upgradeable mutex is a sign that the design could be improved. The implementation overhead of an upgradeable mutex is quite large, more so even than a simple shared mutex, so you may well be better off performance-wise with just a plain mutex. Certainly, it is worth profiling.

The other issue is that the design Howard posted (and the design of the boost equivalent) is fragile --- it is easy to write incorrect code, and especially easy to write code which is only incorrect on infrequently-used paths, such as error cases and when an exception is thrown.

by Anthony Williams at 17:55:19 on Tuesday, 07 May 2013

Thanks for this report Anthony. Could you share any additional details on the motivation for voting down N3636? I've recently been thinking about this very issue and haven't been able to come up with a use case for a (non-detached) std::thread object which is *not* wrapped in an RAII class designed to call join. Calling std::terminate is rarely the desired behaviour for any code so why is it preferred over join in this case? Thanks.

by Andrew Durward at 18:47:27 on Friday, 10 May 2013

This is nice information because i was also searching this type of help and techniques in my work. thanks again.

by Dipti Kapoor at 10:13:12 on Wednesday, 05 February 2014

nice post

by Sarah Nelson at 09:21:23 on Monday, 10 March 2014

:-PMI’s Project Management Professional (PMP)® credential is the most important industry-recognized certification for project managers. Recently I went for a <a href="www.PMstudy.com/">PMP prep course</a> by the training provider you have mentioned, Instructer was too good and I passed with relative ease. Looking forwards to apply what I learned in <a href="www.PMstudy.com/">PMP classes</a> in my company.

by Olivia Jennifer at 09:21:50 on Monday, 10 March 2014

:- yeah its a intersting article about the improvement of project. For a better result of your project you may apply scrum in your project. I recently got my <a href="www.scrumstudy.com/">agile scrum certification</a> ; <a href="http://www.scrumstudy.com/scrum-master-certification.asp">Scrum Master Certification</a> offered by ScrumStudy to be precise.

by Alexia Marthoon at 09:22:11 on Monday, 10 March 2014
I was looking for something like this…I found it quiet interesting, hopefully you will keep posting such blogs….Keep sharing.
by Keukenblad at 11:20:12 on Thursday, 17 July 2014

Add your comment

Your name:

Your URL:

Email address:

Person or spambot?

Your comment: