condition variables

Performance Comparison of Condition Variables and Atomics in C++20

After the introduction to std::atomic_flag in my last post Synchronization with Atomics in C++20, I want to dive deeper. Today, I create a ping-pong game using condition variables, std::atomic_flag, and std::atomic<bool>. Let's play.

Read more
Views: 41858

Synchronization with Atomics in C++20

Sender/receiver workflows are quite common for threads. In such a workflow, the receiver is waiting for the sender's notification before it continues to work. There are various ways to implement these workflows. With C++11, you can use condition variables or promise/future pairs; with C++20, you can use atomics.

Read more
Views: 27527

C++ Core Guidelines: Be Aware of the Traps of Condition Variables

Today, I write a scary post about condition variables. You should be aware of these issues of condition variables. The C++ core guideline CP 42 just states: "Don't wait without a condition".

Read more
Views: 301694

The Atomic Boolean

The remaining atomics - in contrast to std::atomic_flag - are partial or full specialisations of the class template std::atomic. Let's start with std::atomic<bool>.

Read more
Views: 188235

Thread Synchronization with Condition Variables or Tasks

In case you use promise and future to synchronize threads, they have much in common with condition variables. But most of the time, tasks are the better choice.

Read more
Views: 64649

Condition Variables

Condition variables allow us to synchronize threads via notifications. So, you can implement workflows like sender/receiver or producer/consumer. In such a workflow, the receiver is waiting for the sender's notification. If the receiver gets the notification, it continues its work.

Read more
Views: 109380

Mentoring

Stay Informed about my Mentoring

 

English 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

Interactive Course: The All-in-One Guide to C++20

Subscribe to the newsletter (+ pdf bundle)

All tags

Blog archive

Source Code

Visitors

Today 2795

Yesterday 5317

Week 2795

Month 146966

All 11628120

Currently are 261 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments