Compare commits

..

2 Commits

Author SHA1 Message Date
glebchik_gg
5172a991cd Merge branch 'main' of https://git.rabbit-hole-ru.ru/harry_potter/qwe
Some checks are pending
Compile and Run C++ / build-and-test (push) Waiting to run
2026-06-27 17:13:51 +03:00
glebchik_gg
7a722ba478 asd 2026-06-27 17:13:19 +03:00
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;
}