threadLocal

Thread-Local Data

/
By using the keyword thread_local, you define the thread local data. Thread-local can easily be…
callOnce

Thread-Safe Initialization of Data

/
The story is simple if the data is not modified when shared between threads. The data has only to be…
deadlockResolved

Prefer Locks to Mutexes

/
If the previous post showed something, it's that you should use mutexes with great care. That's why you…
Deadlock

The Risks of Mutexes

/
The usage of mutexes seems extremely simple. There is a critical section in the code that a single thread…
readerWriterLocks

Reader-Writer Locks

/
With C++14 came reader-writer locks. The idea is straightforward and promising. Arbitrary reading threads…
bossWorker

Threads Sharing Data

/
One of the biggest challenges of thread management begins when the threads share non-const data Data…
Sleeper

Thread Arguments

/
A thread gets its data by copy or by reference. By default, you should use by copy. Why? In case your…
threadForgetJoin

Threads Lifetime

/
The parent has to take care of their child. This simple idea has big consequences for a thread lifetime.…
createThread

Thread Creation

/
Thread creation is easy. Call  std::thread, and a new thread will be created. The thread gets a…