У меня есть класс, в котором есть такой поток: [code]// USING C++ 17 #include #include #include #include
class MyClass { std::thread thread; std::string mystring;
public: bool done = false;
MyClass(std::string string) { mystring = string;
thread = std::thread(&MyClass::worker, std::ref(*this)); thread.detach(); } void worker() { // notice how mystring has the wrong value, some of the time std::cout