Я хочу, чтобы запустить поток, который делает что-то так просто, как это:нагрузочного работает нить с ++ станд :: нить
main(){
std::thread thread_pulse([=]{
*this->do_adress = true;
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
*this->do_adress = false;
//delete this thread to avoid memory leaks
});
//do some other stuff without waiting for the thread to terminate
}
как я уверяю, что, когда выполнение потока осуществляется поток удален, и есть нет утечки памяти, не дожидаясь завершения потока на главном?
EDIT:
спасибо за помощь, ти с помощью этого работал как я хотел
main(){
std::thread ([=]{
*this->do_adress = true;
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
*this->do_adress = false;
//delete this thread to avoid memory leaks
}).detach;
//do some other stuff without waiting for the thread to terminate
}
'std :: thread thread_pulse (...); thread_pulse.detach(); ' –