Advertisement
Guest User

threadgolf

a guest
Nov 19th, 2022
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. DWORD ThreadFunc(void *) {
  7.     for (;;);
  8. }
  9.  
  10. int main() {
  11.     for (int i = 0; i < 100000; i++) {
  12.         if (i % 100 == 0) {
  13.             std::cout << "Here " << i << std::endl;
  14.         }
  15.         HANDLE hThread = CreateThread(NULL, 0, ThreadFunc, NULL, 0, NULL);
  16.         if (!TerminateThread(hThread, 42)) {
  17.             std::cout << "niasilil" << std::endl;
  18.         }
  19.         CloseHandle(hThread);
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement