std::thread::join is not thread safe. Calling join on the same thread object from multiple threads is a data race it is Undefined Behaviour.