stress_test.cpp

来自「ExcpHook is an open source (see license.」· C++ 代码 · 共 45 行

CPP
45
字号
#define _WIN32_WINNT 0x505
#include <cstdio>
#include <windows.h>

using namespace std;

LONG CALLBACK MyHandler(
 PEXCEPTION_POINTERS ExceptionInfo
)
{
  putchar('.');
  return EXCEPTION_CONTINUE_EXECUTION;
}

DWORD WINAPI MyThread(PVOID a)
{
  while(1)
  {
    *(int*)0 = 0; 
  }

  return 0;
}

int
main(void)
{
  int i;
  puts("Press ctrl-c to stop");
  AddVectoredExceptionHandler(1, MyHandler);
 

  for(i = 0; i < 10; i++)
  {
    CreateThread(NULL, 0, MyThread, 0, 0, NULL);
  }

  while(1)
  {
  }
 
  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?