int CSafeThread::ExitInstance() { #ifndef _DEBUG crUninstallFromCurrentThread(); #endif return CWinThread::ExitInstance(); }
DWORD WINAPI CrashRptAPITests::ThreadProc3(LPVOID /*lpParam*/) { int i; for(i=0; i<100; i++) { // Install thread exception handlers - should succeed int nResult = crInstallToCurrentThread(); TEST_ASSERT(nResult==0); Sleep(10); // Uninstall - should succeed int nUnResult2 = crUninstallFromCurrentThread(); TEST_ASSERT(nUnResult2==0); } __TEST_CLEANUP__; crUninstallFromCurrentThread(); return 0; }
DWORD WINAPI CrashRptAPITests::ThreadProc2(LPVOID /*lpParam*/) { // Uninstall before install - should fail int nUnResult = crUninstallFromCurrentThread(); TEST_ASSERT(nUnResult!=0); // Install thread exception handlers - should succeed int nResult = crInstallToCurrentThread(); TEST_ASSERT(nResult==0); // Install thread exception handlers the second time - should fail int nResult2 = crInstallToCurrentThread(); TEST_ASSERT(nResult2!=0); __TEST_CLEANUP__; // Uninstall - should succeed crUninstallFromCurrentThread(); return 0; }
r3dThreadAutoInstallCrashHelper::~r3dThreadAutoInstallCrashHelper() { #ifndef DISABLE_CRASHRPT crUninstallFromCurrentThread(); #endif }