I have a small class that creates multiple threads. When I call stop() method, it sets a flag for stopping threads and joins on the thread until they are stopped. Here is the code of stop() method:
void stop() {
running_flag_ = false;
for (auto& th : threads_) {
if (th.joinable())
th.join();
}
}
I wonder if there is a way to test if this method works as expected, meaning this method should always return. I don't think dead test is really suitable here. Any idea if there is a way to test this?