Найти в Дзене
1 подписчик

#include <iostream>

#include <thread>
#include <atomic>

std::atomic<bool> likeButtonPressed(false);

void blogThread()
{
while (!likeButtonPressed)
{
std::cout << "Hello, world, it's Archy" << std::endl;
}
}

int main()
{
std::thread threadObj(blogThread);

likeButtonPressed = true;

threadObj.join();

return 0;
}
Около минуты