lock

Single Threaded: Summation of a Vector

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.

Read more
Tags: atomics, lock
Comments 6Views: 3011

Thread-Safe Initialization of a Singleton

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.

Read more
Comments 6Views: 6280

Ongoing Optimization: Locks and Volatile with CppMem

The easiest way to solve the undefined behaviour in the post Ongoing Optimization: Unsynchronized access is, to use a lock.

Read more
Add CommentViews: 1400

Reader-Writer Locks

With C++14 came reader-writer locks. The idea is straightforward and promising. Arbitrary reading threads can access the critical region at the same time, but only one thread is allowed to write.

Read more
Tags: lock
Comments 3Views: 3156

Prefer Locks to Mutexes

If the previous post showed something, it's, that you should use mutexes with great care. That's why you should wrap them in a lock.

Read more
Tags: lock, mutex
Comments 17Views: 2725

My Newest E-Book

Latest comments

Subscribe to the newsletter (+ pdf bundle)

Blog archive

Source Code

Visitors

Today 136

All 279144

Currently are 147 guests and no members online