lock

What is the fastest way to add the elements of a std::vector?. A question which I will pursue in the next posts. I use the single threaded addition as reference number. In further posts I discuss atomics, locks, and thread local data.

There are a lot of issues with the singleton pattern. I'm totally aware of that. But the singleton pattern is an ideal use case for a variable, which has only to be initialized in a thread safe way. From that point on you can use it without synchronization. So in this post I discuss different ways to initialize a singleton in a multithreading environment. You get the performance numbers and can reason about your uses cases for the thread safe initialization of a variable.