unsafe private static void* InitializeCompareInfo(void* pNativeGlobalizationAssembly, int sortingLCID) {
void* pTemp = null;
bool tookLock = false;
RuntimeHelpers.PrepareConstrainedRegions();
try
{
// This is intentionally taking a process-global lock, using a CER
// to guarantee we release the lock.
// Note that we should lock on a internal mscorlib type, so that
// no public caller can block us by locking on the same type.
Monitor.ReliableEnter(typeof(CultureTableRecord), ref tookLock);
// we should lock on the call of InitializeNativeCompareInfo because it uses native static
// variables that are not safe to be accessed in same time from different threads.
// Since we're just calling an FCALL method here that will
// probe for stack space, we don't need to use
// ExecuteCodeWithGuaranteedCleanup here.
pTemp = InitializeNativeCompareInfo(pNativeGlobalizationAssembly, sortingLCID);
}
finally
{
if (tookLock)
Monitor.Exit(typeof(CultureTableRecord));
}
BCLDebug.Assert(pTemp != null, "pTemp != null");
return (pTemp);
}