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

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

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

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

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

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

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 1752

Yesterday 4344

Week 38630

Month 18876

All 12097085

Currently are 144 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments