Exemplo n.º 1
0
        internal static GlobalizationAssembly GetGlobalizationAssembly(Assembly assembly)
        {
            GlobalizationAssembly assembly2 = (GlobalizationAssembly)m_assemblyHash[assembly];

            if (assembly2 == null)
            {
                RuntimeHelpers.TryCode code = new RuntimeHelpers.TryCode(GlobalizationAssembly.CreateGlobalizationAssembly);
                RuntimeHelpers.ExecuteCodeWithLock(typeof(CultureTableRecord), code, assembly);
                assembly2 = (GlobalizationAssembly)m_assemblyHash[assembly];
            }
            return(assembly2);
        }
Exemplo n.º 2
0
        /*=================================GetGlobalizationAssembly==========================
         **Action: Return the GlobalizationAssembly instance for the specified assembly.
         **  Every assembly should have one and only one instance of GlobalizationAssembly.
         **Returns: An instance of GlobalizationAssembly.
         **Arguments:
         **Exceptions:
         **============================================================================*/
        internal static GlobalizationAssembly GetGlobalizationAssembly(Assembly assembly)
        {
            GlobalizationAssembly ga;

            if ((ga = (GlobalizationAssembly)m_assemblyHash[assembly]) == null)
            {
                // This is intentionally taking a process-global lock on an
                // internal Type, using ExecuteCodeWithLock to guarantee we
                // release the lock in a stack overflow safe way.
                RuntimeHelpers.TryCode createGlobalizationAssem = new RuntimeHelpers.TryCode(CreateGlobalizationAssembly);
                RuntimeHelpers.ExecuteCodeWithLock(typeof(CultureTableRecord),
                                                   createGlobalizationAssem,
                                                   assembly);
                ga = (GlobalizationAssembly)m_assemblyHash[assembly];
            }
            BCLDebug.Assert(ga != null, "GlobalizationAssembly was not created");
            return(ga);
        }