本文整理汇总了C++中Thread::ClearDoNotTriggerGc方法的典型用法代码示例。如果您正苦于以下问题:C++ Thread::ClearDoNotTriggerGc方法的具体用法?C++ Thread::ClearDoNotTriggerGc怎么用?C++ Thread::ClearDoNotTriggerGc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thread
的用法示例。
在下文中一共展示了Thread::ClearDoNotTriggerGc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InvokeGcCallouts
// Invoke all the registered GC callouts of the given kind. The condemned generation of the current collection
// is passed along to the callouts.
void RestrictedCallouts::InvokeGcCallouts(GcRestrictedCalloutKind eKind, UInt32 uiCondemnedGeneration)
{
ASSERT(eKind < GCRC_Count);
// It is illegal for any of the callouts to trigger a GC.
Thread * pThread = ThreadStore::GetCurrentThread();
pThread->SetDoNotTriggerGc();
// Due to the above we have better suppress GC stress.
bool fGcStressWasSuppressed = pThread->IsSuppressGcStressSet();
if (!fGcStressWasSuppressed)
pThread->SetSuppressGcStress();
GcRestrictedCallout * pCurrCallout = s_rgGcRestrictedCallouts[eKind];
while (pCurrCallout)
{
// Make the callout.
((GcRestrictedCallbackFunction)pCurrCallout->m_pCalloutMethod)(uiCondemnedGeneration);
pCurrCallout = pCurrCallout->m_pNext;
}
// Revert GC stress mode if we changed it.
if (!fGcStressWasSuppressed)
pThread->ClearSuppressGcStress();
pThread->ClearDoNotTriggerGc();
}
示例2: InvokeRefCountedHandleCallbacks
// Invoke all the registered ref counted handle callouts for the given object extracted from the handle. The
// result is the union of the results for all the handlers that matched the object type (i.e. if one of them
// returned true the overall result is true otherwise false is returned (which includes the case where no
// handlers matched)). Since there should be no other side-effects of the callout, the invocations cease as
// soon as a handler returns true.
bool RestrictedCallouts::InvokeRefCountedHandleCallbacks(Object * pObject)
{
bool fResult = false;
// It is illegal for any of the callouts to trigger a GC.
Thread * pThread = ThreadStore::GetCurrentThread();
pThread->SetDoNotTriggerGc();
// Due to the above we have better suppress GC stress.
bool fGcStressWasSuppressed = pThread->IsSuppressGcStressSet();
if (!fGcStressWasSuppressed)
pThread->SetSuppressGcStress();
HandleTableRestrictedCallout * pCurrCallout = s_pHandleTableRestrictedCallouts;
while (pCurrCallout)
{
if (pObject->get_SafeEEType() == pCurrCallout->m_pTypeFilter)
{
// Make the callout. Return true to our caller as soon as we see a true result here.
if (((HandleTableRestrictedCallbackFunction)pCurrCallout->m_pCalloutMethod)(pObject))
{
fResult = true;
goto Done;
}
}
pCurrCallout = pCurrCallout->m_pNext;
}
Done:
// Revert GC stress mode if we changed it.
if (!fGcStressWasSuppressed)
pThread->ClearSuppressGcStress();
pThread->ClearDoNotTriggerGc();
return fResult;
}