Last active
September 24, 2019 01:34
-
-
Save Sam-Belliveau/44c8aa21f81f315561723f670ad8677d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <thread> | |
| #include <functional> | |
| #include <cstdio> | |
| std::function<void(void)> ThreadKiller = []() | |
| { | |
| std::thread BabyThread1(ThreadKiller); | |
| volatile std::intmax_t total; | |
| for(volatile std::size_t i = 1; i != 0; ++i) | |
| for(volatile std::size_t j = 2; j < i; ++j) | |
| if(i % j == 0 || j % i == 0) ++total; | |
| else --total; | |
| BabyThread1.join(); | |
| }; | |
| int main() { | |
| std::fputs("+-----= Starting ThreadHell =-----+\n", stderr); | |
| std::fputs("| ThreadHell will attempt to take |\n", stderr); | |
| std::fputs("| as much CPU time as possible! |\n", stderr); | |
| std::fputs("+---------------------------------+\n", stderr); | |
| ThreadKiller(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment