How to Write Safe and Expressive Multi-Threaded Code in C++11—Louis-Charles Caron

Save to:
Instapaper Pocket Readability

Did you think about that?

How to Write Safe and Expressive Multi-Threaded Code in C++11

by Louis-Charles Caron

From the article:

I started writing multi-threaded code two years ago. Two years and one day ago, I would start sweating at the sound of the the words thread and mutex. But after literally a few days of practice (and, I admit, a 3-day course on multi-threading and C++11), I figured the basic principles are quite understandable.

Typical multi-thread problems can be solved by using a handful of tools. Admittedly, complex problems are even more complex when they appear in multi-threaded code, but I did not happen to run into those yet.

Since C++11, one now finds the necessary multi-threading tools in the C++ standard library. Finally! We can write multi-threaded code in pure C++.

The multi-threading part of the C++11 library is functional: it is simple and to the point. However, it is nearly impossible to write clear and expressive multi-threaded code using only the C++11 tools. And when multi-threaded code is not clear, it tends not to be safe.

In this article, I introduce some multi-threading tools you will find in the C++11 standard library through a code example. Although simple, this example will clearly demonstrate the shortcomings of the C++11 standard library. Then, I present safe: a small header-only C++11 library I designed to make my multi-threaded code more expressive, and ultimately safer...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.