This commit is contained in:
glebchik_gg 2026-06-27 17:13:19 +03:00
parent 46e869d302
commit 7a722ba478
2 changed files with 57 additions and 0 deletions

24
.gitea/workflows/qwe.yml Normal file
View File

@ -0,0 +1,24 @@
name: Compile and Run C++
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install GCC
run: sudo apt-get update && sudo apt-get install -y g++
- name: Compile C++ program
run: g++ -o qweq qweq.cpp
- name: Run program
run: ./qweq

33
qweq.cpp Normal file
View File

@ -0,0 +1,33 @@
#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;
}