CppCon 2018 has ended
Back To Schedule
Thursday, September 27 • 14:00 - 15:00
What do you mean "thread-safe"?

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

How can we communicate with other developers about the safety of our C++ code against the hazards of concurrency? Terms like "thread-safe" don't always have a clear meaning, and more precise terms like "data race" and "race condition" often operate at the wrong level of abstraction. In order to communicate effectively about these issues, we need straightforward ways to talk about the safety requirements that APIs impose, and what goes wrong if you violate them.

In this talk, I will present the simple yet precise vocabulary we use for talking about these issues at Google: an "API race" happens when two operations access the same object concurrently, in violation of its contract. For most C++ types, that contract can be classified as "thread-safe" or "thread-compatible" depending on what combinations of operations can cause an API race (the remainder are called "thread-unsafe"), and that two-word classification usually tells you everything you need to know to avoid API races on the object. This is significant because if you can avoid API races, you can avoid not only all data races but also many race conditions.


Geoffrey Romer

Software Engineer, Google
I'm a Staff Software Engineer on the C++ Library Team at Google, and the lead author of Google's C++ concurrent programming guide. My work focuses on improving the C++ programming experience at Google and beyond, which has led me to focus on problem areas such as concurrent programming... Read More →

Thursday September 27, 2018 14:00 - 15:00 PDT
Aspen Highlands Hall (1st Floor)
  • Concurrency and Parallelism