Terminate workers
问题 I've got a function which starts a number of worker threads. Each worker thread is encapsulated by an object, and the destructor of that object will try to join the thread, i.e calls if (thrd_.joinable()) thrd_.join(); . But it is unknown a priori how much work each worker will have to perform. the managing function assigns work units to the threads using a mutex and a condition variable. If there is no more work to do, a certain flag is set while the mutex is being held, and then all threads