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 created a ping-pong game using condition variables, std::atomic_flag and std::atomic<bool>. Let's play.

Read more
Views: 44312

Synchronization with Atomics in C++20

Sender/receiver workflows are pretty 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: 29666

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

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

Read more
Views: 309398

The Atomic Boolean

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

Read more
Views: 193171

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: 66531

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 waits for the sender's notification. If the receiver gets the notification, it continues its work.

Read more
Views: 115003

Stay Informed about my Mentoring

 

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

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

Course: Master Software Design Patterns and Architecture in C++

Subscribe to the newsletter (+ pdf bundle)

All tags

Blog archive

Source Code

Visitors

Today 3780

Yesterday 4371

Week 39587

Month 169712

All 12057478

Currently are 162 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments