Published Articles and Presentations

Here is a list of articles and other publications written by one of our directors, Anthony Williams. In each case, the title is linked to the online version.

Book

Anthony is the author of C++ Concurrency in Action, published by Manning, which provides a comprehensive tutorial and reference to the multithreading support in C++11.

Articles

Issue / Publication DatePublicationTitleDescription
September 2010DrDobbs.com Concept Checking Without Concepts in C++ One of the important features of the now-defunct C++0x Concepts proposal was the ability to overload functions based on whether or not their arguments met certain concepts. This article describes a way to allow that for concepts based on the presence of particular member functions.
May 2010DrDobbs.com Enforcing Correct Mutex Usage with Synchronized Values This article expands on the SynchronizedValue<T> template I mentioned in my presentation on Concurrency in the Real World at ACCU 2010, and deals with the problem of ensuring that the mutex associated with some data is locked whenever the data is accessed.
April 2010DrDobbs.com Simple Concurrency with Dataflow Variables in C++ Dataflow variables are write-once read-many variables with in-built synchronization. In this article I explain how they can be used to write scalable code with no race conditions, and how to implement them in C++.
September 2009DevX.com Avoiding the Perils of C++0x Data Races Race conditions are one of the biggest causes of problems in multithreaded code. This article takes a brief look at some of the ways in which race conditions can occur. There is also sample code that demonstrates the perils of data races by showing how even simple code with a data race can lead to corrupt data.
May 2009DevX.com Introduction to Variadic Templates in C++0x This article introduces the new variadic template facility from C++0x, which allows you to write templates that take a variable number of template arguments.
November 2008Dr. Dobb's Journal What's New in Boost Threads? This article gives an overview of the new features added to the Boost thread library in the recent releases.
September 2008Codeguru.com Deadlock: The problem and a solution This is an excerpt from Anthony's book C++ Concurrency in Action, and describes the problem of deadlock and ways to avoid it.
August 2008DevX.com Simpler Multithreading in C++0x Part of DevX.com's Special Report on C++0x, this article provides a whistle-stop tour of the new C++0x multithreading support.
August 2008Overload 86 Exceptions make for Elegant Code This article is a slightly expanded version of my blog entry: Exceptions make for Elegant Code.
April 2008Dr. Dobb's Journal Optimizing Math-intensive Applications with Fixed Point Arithmetic This article describes the fixed-point techniques used to vastly improve the performance of an application using sines, cosines and exponentials without hardware floating point support.
The source code referenced in the article can be downloaded from here. It is released under the Boost Software License.
April 2007Overload 78 Implementing Synchronization Primitives for Boost on Windows Platforms This article describes the techniques involved in writing a new mutex implementation for Windows.
June 2006CVu 18.3 Building on a Legacy This article discusses ways of handling legacy code, and how to work so that maintenance gets easier rather than harder.
June 2006Overload 73 Implementing drop-down menus in pure CSS (no JavaScript) This article describes the details behind implementing drop-down menus with CSS in a cross-browser fashion.
May 2006Dr. Dobb's Journal Message Handling Without Dependencies This article describes a type-safe technique for passing messages around an application in C++, without requiring extensive coupling between the producer and consumer
April 2004CVu 16.2 Writing Maintainable Code A brief summary of techniques to help you write maintainable code.
November 2003C/C++ Users Journal Strong Exception-Safe Storage This article describes the use of a double-buffer technique to provide the Strong Exception Safety Guarantee without the use of dynamic memory, even when the underlying data only provides the Basic Exception Safety Guarantee.
April 2003Overload 54 EXPR_TYPE — An Implementation of typeof Using Current Standard C++ (PDF) typeof is a much-sought-after facility that is lacking from current C++; it is the ability to declare a variable to have the same type as the result of a given expression, or make a function have the same type as an expression. The general idea is that typeof(some-expression) would be usable anywhere a type name could normally be used. This article describes a way of providing this ability within the realms of current C++. There is code to accompany this article.
October 2002Overload 51 Pairing Off Iterators (PDF) This article describes the implementation of an iterator adaptor that converts a pair of ranges into a range of pairs, so that two containers can be sorted by a key held in only one of them, for example. The code is available for download
October 2001Overload 45 Introduction to C++ Templates (PDF) This is a brief introduction to C++ templates - how they work, how to use them, and how to write your own.
August 2001Overload 44 Flexible Functors and Binders (PDF) This article describes a set of binders to assist writing programs using the Functional Programming style, and a set of adaptors for other functors, such as pointers-to-functions and pointers-to-member-functions, to enable them to be integrated seamlessly. The code to accompany the article can be downloaded.
April 2001Overload 42 A Generic Non-Intrusive Smart Pointer Implementation (PDF) This article describes the implementation of a smart pointer that can be freely converted to and from a raw pointer, or other types of smart pointer, without losing its reference count. It also permits the use of arrays, and the use of dynamic_cast. The code to accompany the article can be downloaded. There is an erratum for this article.

Presentations

DateLocationTitleDescription
14th April 2010ACCU 2010 "Concurrency in the Real World" This talk covered the common problems people have with multithreaded and concurrent code, and some solutions to those problems, with examples in C++. It also covered the potential benefits of using concurrency, along with some things to watch out for in pursuit of those benefits. The slides are available as a PDF.
23rd April 2009ACCU 2009 "Designing Multithreaded Applications with C++0x" This talk covered the issues involved in designing multithreaded applications, along with examples of how to approach them from a C++0x perspective. This included an overview of the new C++0x thread library, examples of how features such as futures can affect the programming model, and issues to think about when reviewing and testing multithreaded code. The slides are available as a PDF, along with a ZIP file with the sample code for the Concurrent Queue and Numerical Integration demonstrations that I did during the presentation using our just::thread implementation of the C++0x thread library.
3rd April 2008ACCU 2008 The Future of Concurrency in C++ With the next version of the C++ Standard (C++0x), concurrency support is being added to C++. This means a new memory model with support for multiple threads of execution and atomic operations, and a new set of library classes and functions for managing threads and synchronizing data. There are also further library enhancements planned for the next technical report (TR2). This talk will provide an overview of the new facilities, including an introduction to the new memory model, and an in-depth look at how to use the new library. Looking forward to TR2, this talk covered the proposed library extensions, and how facilities like futures will affect the programming model. The slides are available as a PDF.
3rd April 2002ACCU Spring Conference 2002 Function Composition and Return Type Deduction (PDF) This presentation describes my function composition library, which is available for download. This library provides a facility for creating composite functions from basic ones at the point of use, and can be used to create a simple lambda expression facility.

C++ Standards Committee Papers

Issue / Publication DatePublicationTitleDescription
September 2009C++ Standards Committee Mailing N2959: Managing the lifetime of thread_local variables with contexts (Revision 1) This is a revision of my earlier paper, N2907 which expands my proposal for a thread_local_context class, along with full proposed wording. I think this provides a workable solution to the general problem of ensuring that destructors for thread_local variables are run at particular points in the execution of a program as discussed in N2880.
September 2009C++ Standards Committee Mailing N2967: Issues on Futures This paper that I co-authored with Detlef Vollmann provides a complete rewording for the "Futures" section of the standard (30.6). It folds the proposed changes from N2888 in with changes requested by the LWG at July's meeting (including the addition of a new future type — atomic_future which serializes all operations), and editorial comments on the earlier wording. It doesn't resolve everything — there is still some discussion over whether unique_future::get() should return a value or a reference, for example — but it provides a sound basis for further discussion.
June 2009C++ Standards Committee Mailing N2907: Managing the lifetime of thread_local variables with contexts This paper introduces the idea of a thread_local_context which manages the lifetime of variables declared thread_local. In particular, this concept is introduced to manage the interaction of thread_local variables with detached threads and asynchronous function calls.
June 2009C++ Standards Committee Mailing N2888: Moving Futures - Proposed Wording for UK comments 335, 336, 337 and 338 This paper provides rationale and proposed wording for the UK comments on the C++ working draft requesting move semantics for std::unique_future and std::shared_future.
July 2008C++ Standards Committee Mailing N2709: Packaging Tasks for Asynchronous Execution This paper proposes a revised version of packaged_task following its removal from N2671.
June 2008C++ Standards Committee Post-Sophia Antipolis Mailing N2671: An Asynchronous Future Value Proposed Wording Jointly authored with Deltef Vollmann and Howard Hinnant. An updated version of N2627 with proposed wording. packaged_task has been removed for a later proposal.
May 2008C++ Standards Committee Pre-Sophia Antipolis Mailing N2627: An Asynchronous Future Value (Revised) Jointly authored with Deltef Vollmann and Howard Hinnant. An updated version of N2561.
March 2008C++ Standards Committee Post-Bellevue Mailing N2561: An Asynchronous Future Value Jointly authored with Deltef Vollmann and Howard Hinnant. Futures, promises and packaged tasks for multi-threaded programming. See Futures and Tasks in C++0x for a summary.
September 2007C++ Standards Committee Pre-Kona Mailing Names, Linkage and Templates (Rev 2) (PDF) This paper is an update to the earlier proposals for making local types usable with templates (N1945 and N2187), with revised wording.
June 2007C++ Standards Committee Pre-Toronto Mailing Multi-threading library for Standard C++ This paper (jointly authored with Howard Hinnant, Beman Dawes, Lawrence Crowl and Jeff Garland) proposes a set of classes for a basic thread library for C++, including thread launching, mutexes and condition variables.
May 2007C++ Standards Committee Post-Oxford Mailing Thread Pools and Futures This paper proposes new classes to the C++ Standard Library for thread pools and futures, to build on top of the new threading facilities.
March 2007C++ Standards Committee Pre-Oxford Mailing Names, Linkage and Templates (rev 1) (PDF) This paper is an update to the earlier proposal for making local types usable with templates (N1945), with revised examples, motiviation and wording.
November 2006C++ Standards Committee Post-Portland Mailing Thoughts on a Thread Library for C++ This paper outlines thoughts on various aspects of a thread library for C++, including one-time initialization, and general thread synchronization.
February 2006C++ Standards Committee Pre-Berlin Mailing Names, Linkage and Templates (PDF) This paper proposes that the C++ Standard is changed, so that unnamed and local types have linkage, in order to simplify the language and make these types usable with templates.
March 2003C++ Standards Committee Pre-Oxford Mailing Making Local Classes more Useful (PDF) This paper proposes a couple of small changes to the C++ Standard: to allow local classes to work with templates, and to allow local classes to declare friend functions.