Код: Выделить всё
#include
#include
void threadRun(int& number) {
while(true) {
std::this_thread::sleep_for(std::chrono::seconds(2));
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/60792100/is-passing-a-reference-to-a-local-variable-in-main-to-other-threads-functions[/url]
Мобильная версия