qwe/qweq.cpp
glebchik_gg 7a722ba478 asd
2026-06-27 17:13:19 +03:00

34 lines
618 B
C++

#include <iostream>
#include <thread>
#include <vector>
#include <chrono>
#include <atomic>
std::atomic<bool> running{true};
void cpu_burner() {
while (true) {
volatile double x = 1.0;
for (int i = 0; i < 1000000; ++i) {
x += x * 0.000001;
x -= x * 0.000001;
}
}
}
int main() {
int cores = std::thread::hardware_concurrency();
if (cores == 0) cores = 4;
std::vector<std::thread> threads;
for (int i = 0; i < cores; ++i) {
threads.emplace_back(cpu_burner);
}
for (auto& t : threads) {
t.join();
}
return 0;
}