C++ Multi Threading Part 3: Atomic Variables and Memory Models

Опубликовано: 25 Май 2026
на канале: arisaif
30,438
658

I explain what atomic variables (std::atomic) and how to use them in modern C++. I describe methods of the atomic template provided by STL in details. In particular: load, store, exchange, compare_exchange_strong, compare_exchange_weak.

Also, I cover C++ memory orders such as:

memory_order_seq_cst
memory_order_acquire
memory_order_release
memory_order_relaxed

I use modern C++11, C++14, and C++17 constructs.

This is my second video on C++ Multithreading.
Link to Part 1:    • Learn C++ Multi Threading in 20 Minutes  
Link to Part 2:    • C++ Multi Threading Part 2: Mutex And Cond...  

You can download and code with me using this link:
https://github.com/ourarash/multithre...

You can run the code either using Bazel or gcc/g++.

Check my other video on using Bazel to build C++ files in Visual Studio Code:

   • Bazel & Google Test in Visual Studio Code  

More details on Bazel:
https://github.com/ourarash/cpp-template

-----------------------------------------------------
See my other videos on:
Bazel and unit tests with GTest:    • Bazel & Google Test in Visual Studio Code  
Debugging in Visual Studio Code for C++:    • Debugging C++ in Visual Studio Code using ...  
Visual Studio Code, Top Features:    • Visual Studio Code Top Features 2020  
-----------------------------------------------------
Keep in touch with me:
  / ourarash  

I'm the founder of BitcoinCrazyness app, the Most Advanced Cryptocurrency mobile APP for alerts, Check it out:

http://www.bitcoincrazyness.com/