C++ Core Guidelines: Taking Care of your Child Thread

When you create a new child thread, you have to answer an important question: should you wait for the child or detach yourself from it? If you detach yourself from the newly created child, and your child uses variables which are bound to your lifetime as creator a new question arises: Will the variables stay valid during the lifetime of the child thread?

Read more
Views: 31500

C++ Core Guidelines: Sharing Data between Threads

If you want to have fun with threads, you should share mutable data between them. In order to get no data race and, therefore, undefined behaviour, you have to think about the synchronisation of your threads.

Read more
Tags: lock, mutex
Views: 43805

C++ Core Guidelines: Use Tools to Validate your Concurrent Code

Today, I'm happy to write about the probably most important rule of the C++ Core Guidelines for concurrency: Whenever feasible use tools to validate your concurrent code. Not all, but a lot of bugs can be detected with tools and each fixed bug is a good bug. Here are two tools which provided me precious help in the last years: ThreadSanitizer and CppMem.

Read more
Views: 17130

C++ Core Guidelines: More Rules to Concurrency and Parallelism

Writing multithreading programs is hard, even harder if the program should be correct. The rules of the C++ Core Guidelines guide you to write correct programs. The rules of this post will deal with data races, sharing of data, tasks, and the infamous keyword volatile.

Read more
Views: 18464

C++ Core Guidelines: Rules for Concurrency and Parallelism

C++11 is the first C++ standard that deals with concurrency. The basic building block for concurrency is a thread; therefore, most of the rules are explicitly about threads. This changed dramatically with C++17.

 

Read more
Views: 53856

C++ Core Guidelines: The Remaining Rules to Performance

Today, I will write about the remaining 10 rules to performance. Ten rules seem to be a lot but only two of them have actual content.

Read more
Views: 9486

C++ Core Guidelines: More Rules to Performance

In this post, I continue my journey through the rules to performance in the C++ Core Guidelines.  I will mainly write about design for optimisation.

Read more
Views: 12310

C++ Core Guidelines: Rules to Performance

Before I write about the rules of performance I will do a very simple job. Accessing the elements of a container one by one.

Read more
Views: 15061

C++ Core Guidelines: Rules to Statements and Arithmetic

Today, I will write about the remaining rules to statements and the arithmetic rules. If you don't follow the arithmetic rules, undefined behaviour may kick in.

Read more
Views: 8082

C++ Core Guidelines: More about Control Structures

My last German post C++ Core Guidelines: To Switch or not to Switch, that is the Question got a lot of attention. To use a hash table instead of a switch statement seems to be a highly emotional topic. So I change my original plan. Today, I will present different kinds of control structures. I will start with the if and switch statements, continue with the hash table, and end with dynamic and static polymorphism. Additionally, I will mark a few remarks about performance and maintainability. 

Read more
Views: 17911

My Newest E-Books

Course: Modern C++ Concurrency in Practice

Course: C++ Standard Library including C++14 & C++17

Course: Embedded Programming with Modern C++

Course: Generic Programming (Templates)

Course: C++ Fundamentals for Professionals

Subscribe to the newsletter (+ pdf bundle)

Blog archive

Source Code

Visitors

Today 837

All 3971310

Currently are 111 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments