github.com/ice-blockchain/go/src@v0.0.0-20240403114104-1564d284e521/runtime/testdata/testwinlibthrow/veh.c (about)

     1  //go:build ignore
     2  
     3  #include <windows.h>
     4  
     5  __declspec(dllexport)
     6  void RaiseNoExcept(void)
     7  {
     8      RaiseException(42, 0, 0, 0);
     9  }
    10  
    11  static DWORD WINAPI ThreadRaiser(void* Context)
    12  {
    13      RaiseNoExcept();
    14      return 0;
    15  }
    16  
    17  __declspec(dllexport)
    18  void ThreadRaiseNoExcept(void)
    19  {
    20      HANDLE thread = CreateThread(0, 0, ThreadRaiser,  0, 0, 0);
    21      if (0 != thread)
    22      {
    23          WaitForSingleObject(thread, INFINITE);
    24          CloseHandle(thread);
    25      }
    26  }