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: https://github.com/ourarash/multithre... 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: / ourarash

C++ Multi Threading Part 4: Why You Should Use std::jthread in Modern C++

The Cost of Concurrency Coordination with Jon Gjengset

Back to Basics: Exceptions - Klaus Iglberger - CppCon 2020

Dynamic Memory Allocation | C Programming Tutorial

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains

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

I implemented the `md5` algorithm in Bash with 0 external utilities

Learn C++ Multi Threading in 20 Minutes

Back to Basics: C++ Smart Pointers - David Olsen - CppCon 2022

lvalue, rvalue, lvalue references and an intro to rvalue references | Modern Cpp Series Ep. 31

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

ASMR Best Triggers For Sleep Collection (No Talking) 3 Hours of Tapping & Scratching

Google Test and Mock Platform, Complete Tutorial. Part 1: Google Test

When Nanoseconds Matter: Ultrafast Trading Systems in C++ - David Gross - CppCon 2024

Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones

263 DIOS TE DICE HOY: ESA ANGUSTIA QUE TE ROBA LA PAZ SERÁ CAMBIADA POR DESCANSO

Turing Award Winner: Disagreeing with Google, Postgres, Future Problems | Mike Stonebraker

Multithreading in Java Explained in 10 Minutes

Exception Handling In C++ | What Is Exception Handling In C++ | C++ Programming | Simplilearn

