Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver3
19いいね 229回再生

Exception Handling in C++ Multithreading

Learn how to safely handle exceptions in multithreaded C++ programs — and why forgetting this can crash your entire application. In this video, we walk through the rules of exception propagation across threads, how to communicate failures using std::promise, std::exception_ptr, and modern C++20 tools like std::jthread.

🔹 Why exceptions don't cross thread boundaries
🔹 Catching exceptions inside threads the right way
🔹 std::promise & std::future: One-shot exception channels
🔹 std::exception_ptr: The safe way to transfer and rethrow
🔹 RAII + locking: Prevent leaks when exceptions occur

We’ll also cover:

What happens when exceptions escape threads (hint: std::terminate)

Structured error handling in thread pools using central queues

Visual stack diagrams and thread-safe exception propagation

Perfect for C++ developers writing robust, modern multithreaded code in C++17/20.

📌 Full code and diagrams included.
📘 Requires C++11 or newer (C++20 for jthread).
🔔 Subscribe for more modern C++ deep dives.

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

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

This is my fourth 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...  
Link to Part 3:    • C++ Multi Threading Part 3: Atomic Variabl...  

-----------------------------------------------------
See my other videos on:
Bazel Tutorial for C++:    • Bazel Tutorial for C++ in 30 Minutes  
Ultimate Tips on Tech and Coding Job Interviews:    • Ultimate Tips on Tech and Coding Job Inter...  
Google Test and Mock Platform, Complete Tutorial:    • Google Test and Mock Platform, Complete Tu...  
-----------------------------------------------------
Keep in touch with me:
www.linkedin.com/in/ourarash/

コメント