Files
linux-kernel-module-cheat/userland/cpp/count.cpp
Ciro Santilli 六四事件 法轮功 d205140557 userland: move some multithreaded examples from cpp-cheat
Using them mostly to evaluate how well the emulators are handling user
mode multithreading.
2019-07-19 00:00:03 +00:00

17 lines
358 B
C++

// Count to infinity sleeping one second per number.
//
// https://github.com/cirosantilli/linux-kernel-module-cheat#cpp-multithreading
#include <chrono>
#include <thread>
#include <iostream>
int main() {
int i = 0;
while (1) {
std::cout << i << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
i++;
}
}