Interrupting a Blocked Thread in C++ on Linux

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…