Building multi-threaded software in C++ has many pitfalls. One of them is ending your threads. When
you want to cleanly shut down your application, how do you make sure all threads exit? C++20
added std::jthread, which helps you in getting the message that the thread should end into your
threads. But how do you actually stop your threads?
There is no universal answer to this, of course. Whatever code is running in your threads must check
for some exit condition and then exit. There is one especially difficult case, however: What if some
of your threads are blocked in a system call? This article describes a strategy of how you can still
achieve a clean end in your threads in these cases - as long as you are on Linux.