int n;
for (n = 0; n < MaxClrOperation; n++) {
- m_ActionOnTimeout[n] = eNoAction;
m_DefaultAction[n] = eNoAction;
}
- m_ActionOnTimeout[OPR_ProcessExit] = eRudeExitProcess;
- m_ActionOnTimeout[OPR_ThreadAbort] = eAbortThread;
- m_ActionOnTimeout[OPR_ThreadRudeAbortInNonCriticalRegion] = eRudeAbortThread;
- m_ActionOnTimeout[OPR_ThreadRudeAbortInCriticalRegion] = eRudeAbortThread;
m_DefaultAction[OPR_ThreadAbort] = eAbortThread;
m_DefaultAction[OPR_ThreadRudeAbortInNonCriticalRegion] = eRudeAbortThread;
EEPolicy ();
- EPolicyAction GetActionOnTimeout(EClrOperation operation, Thread *pThread)
- {
- WRAPPER_NO_CONTRACT;
- _ASSERTE(static_cast<UINT>(operation) < MaxClrOperation);
- return GetFinalAction(m_ActionOnTimeout[operation], pThread);
- }
-
EPolicyAction GetDefaultAction(EClrOperation operation, Thread *pThread)
{
WRAPPER_NO_CONTRACT;
static void HandleExitProcessFromEscalation(EPolicyAction action, UINT exitCode);
private:
- EPolicyAction m_ActionOnTimeout[MaxClrOperation];
EPolicyAction m_DefaultAction[MaxClrOperation];
EPolicyAction m_ActionOnFailure[MaxClrFailure];
if (now_time >= abortEndTime)
{
- EPolicyAction action1 = eNoAction;
- if (fEscalation)
- {
- if (!IsRudeAbort())
- {
- action1 = GetEEPolicy()->GetActionOnTimeout(OPR_ThreadAbort, this);
- }
- else
- {
- action1 = GetEEPolicy()->GetActionOnTimeout(OPR_ThreadRudeAbortInCriticalRegion, this);
- }
- }
- if (action1 == eNoAction)
+ if (!fEscalation)
{
// timeout, but no action on timeout.
- // Debugger can call this function to about func-eval with a timeout
+ // Debugger can call this function to abort func-eval with a timeout
return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
}
}
{
WRAPPER_NO_CONTRACT;
- EPolicyAction action = eNoAction;
- EClrOperation operation = OPR_ThreadRudeAbortInNonCriticalRegion;
-
if (IsFuncEvalAbort())
{
- // There can't be escalation policy for FuncEvalAbort timeout.
+ // There can't be escalation for FuncEvalAbort timeout.
// The debugger should retain control of the policy. For example, if a RudeAbort times out, it's
// probably because the debugger had some other thread frozen. When the thread is thawed, things might
// be fine, so we don't want to escelate the FuncEvalRudeAbort (which will be swalled by FuncEvalHijackWorker)
return;
}
- if (!IsRudeAbort())
+ if (IsRudeAbort())
{
- operation = OPR_ThreadAbort;
- }
- else
- {
- operation = OPR_ThreadRudeAbortInCriticalRegion;
- }
- action = GetEEPolicy()->GetActionOnTimeout(operation, this);
- // We only support escalation to rude abort
-
- EX_TRY {
- switch (action)
- {
- case eRudeAbortThread:
- MarkThreadForAbort(TAR_Thread, EEPolicy::TA_Rude);
- break;
- case eExitProcess:
- case eRudeExitProcess:
- EEPolicy::HandleExitProcessFromEscalation(action, HOST_E_EXITPROCESS_THREADABORT);
- _ASSERTE (!"Should not reach here");
- break;
- case eNoAction:
- break;
- default:
- _ASSERTE (!"unknown policy for thread abort");
- }
- }
- EX_CATCH {
+ MarkThreadForAbort(TAR_Thread, EEPolicy::TA_Rude);
}
- EX_END_CATCH(SwallowAllExceptions);
}
void Thread::HandleThreadAbort ()