The cost of doing this is showing up in the TechEmpower profiles. There is a lot of thread locale state in unmanaged libraries and OS APIs that the threadpool friendly code has to be aware off. It does not make sense to keep reseting just the Locale.
}
};
{
- ThreadLocaleHolder localeHolder;
-
- {
- ResetFinalizerStartTime resetTime;
- CallFinalizer(fobj);
- }
+ ResetFinalizerStartTime resetTime;
+ CallFinalizer(fobj);
}
pThread->InternalReset();
}
args.bitToCheck = bitToCheck;
GCPROTECT_BEGIN(args.fobj);
{
- ThreadLocaleHolder localeHolder;
-
_ASSERTE(pThreadTurnAround != NULL);
ManagedThreadBase::FinalizerAppDomain(targetAppDomain,
FinalizeAllObjects_Wrapper,
//---------------------------------------------------------------------
#ifndef FEATURE_PAL
-ThreadLocaleHolder::~ThreadLocaleHolder()
-{
- SetThreadLocale(m_locale);
-}
-
HMODULE CLRGetModuleHandle(LPCWSTR lpModuleFileName)
{
// Don't use dynamic contract: will override GetLastError value
HMODULE hMod = WszGetModuleHandle(lpModuleFileName);
return hMod;
}
-
-
-HMODULE CLRGetCurrentModuleHandle()
-{
- // Don't use dynamic contract: will override GetLastError value
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_FORBID_FAULT;
-
- HMODULE hMod = WszGetModuleHandle(NULL);
- return hMod;
-}
-
-
#endif // !FEATURE_PAL
LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes);
#ifndef FEATURE_PAL
HMODULE CLRGetModuleHandle(LPCWSTR lpModuleFileName);
-// Equivalent to CLRGetModuleHandle(NULL) but doesn't have the INJECT_FAULT contract associated
-// with CLRGetModuleHandle.
-HMODULE CLRGetCurrentModuleHandle();
-
HMODULE CLRLoadLibraryEx(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
#endif // !FEATURE_PAL
}
#endif // _DEBUG
-
-// PAL does not support per-thread locales. The holder is no-op for FEATURE_PALs
-class ThreadLocaleHolder
-{
-#ifndef FEATURE_PAL
-public:
-
- ThreadLocaleHolder()
- {
- m_locale = GetThreadLocale();
- }
-
- ~ThreadLocaleHolder();
-
-private:
- LCID m_locale;
-#endif // !FEATURE_PAL
-};
-
-
-
BOOL IsValidMethodCodeNotification(USHORT Notification);
-
+
typedef DPTR(struct JITNotification) PTR_JITNotification;
struct JITNotification
{
ThreadCounter::Counts counts = CPThreadCounter.GetCleanCounts();
if ((MaxLimitTotalCPThreads - counts.NumActive) >= MinimumAvailableCPThreads )
{
- ThreadLocaleHolder localeHolder;
-
QueueUserWorkItemHelp(Function, Context);
return TRUE;
}
}
CONTRACTL_END;
- ThreadLocaleHolder localeHolder;
-
bool foundWork, wasNotRecalled;
ExecuteWorkRequest(&foundWork, &wasNotRecalled);
return ERROR_SUCCESS;
}
{
- ThreadLocaleHolder localeHolder;
-
ThreadpoolMgr::UpdateLastDequeueTime();
ThreadpoolMgr::ExecuteWorkRequest(&foundWork, &wasNotRecalled);
}
{
CONTRACT_VIOLATION(ThrowsViolation);
- ThreadLocaleHolder localeHolder;
-
((LPOVERLAPPED_COMPLETION_ROUTINE) key)(errorCode, numBytes, pOverlapped);
}