Код: Выделить всё
#include
#include
#include
struct Test
{
int threads = 4;
int threads_complete = 0;
bool idle = true;
bool stop = false;
std::mutex mtx;
// A single task
void task(int n)
{
bool done = false;
while (!stop)
{
if (idle || done) continue;
for (int i = 0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/78508389/multithreading-does-not-work-in-release-configuration[/url]