- Exercise

In this exercise, you must make the singleton thread-safe.

We'll cover the following

Task

The classical implementation of the singleton pattern in the code below is not thread-safe. Use the function std::call_once in combination with the std::once_flag to make MySingleton thread-safe.

Get hands-on with 1200+ tech skills courses.