Compare commits
No commits in common. "5172a991cdf2d130948abd36c2b888f50088a49b" and "66f7ae790d0efcd255dce56956222495e62fe047" have entirely different histories.
5172a991cd
...
66f7ae790d
|
|
@ -1,24 +0,0 @@
|
||||||
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
33
qweq.cpp
|
|
@ -1,33 +0,0 @@
|
||||||
#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;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user