当前位置: 首页>>代码示例>>C#>>正文


C# CompressedStack.CompleteConstruction方法代码示例

本文整理汇总了C#中System.Threading.CompressedStack.CompleteConstruction方法的典型用法代码示例。如果您正苦于以下问题:C# CompressedStack.CompleteConstruction方法的具体用法?C# CompressedStack.CompleteConstruction怎么用?C# CompressedStack.CompleteConstruction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Threading.CompressedStack的用法示例。


在下文中一共展示了CompressedStack.CompleteConstruction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateCompressedState

        // public(internal) interface begins... 
        // Creation functions 
        static internal PermissionListSet CreateCompressedState(CompressedStack cs, CompressedStack innerCS)
        { 
            // function that completes the construction of the compressed stack if not done so already (bottom half for demand evaluation)

            bool bHaltConstruction = false;
            if (cs.CompressedStackHandle == null) 
                return null; //  FT case or Security off
 
            PermissionListSet pls = new PermissionListSet(); 
            PermissionSetTriple currentTriple = new PermissionSetTriple();
            int numDomains = CompressedStack.GetDCSCount(cs.CompressedStackHandle); 
            for (int i=numDomains-1; (i >= 0 && !bHaltConstruction) ; i--)
            {
                DomainCompressedStack dcs = CompressedStack.GetDomainCompressedStack(cs.CompressedStackHandle, i);
                if (dcs == null) 
                    continue; // we hit a FT Domain
                if (dcs.PLS == null) 
                { 
                    // We failed on some DCS
                    throw new SecurityException(String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("Security_Generic"))); 
                }
                pls.UpdateZoneAndOrigin(dcs.PLS);
                pls.Update(currentTriple, dcs.PLS);
                bHaltConstruction = dcs.ConstructionHalted; 
            }
            if (!bHaltConstruction) 
            { 
                PermissionListSet tmp_pls = null;
                // Construction did not halt. 
                if (innerCS != null)
                {
                    innerCS.CompleteConstruction(null);
                    tmp_pls = innerCS.PLS; 
                }
                pls.Terminate(currentTriple, tmp_pls); 
            } 
            else
            { 
                pls.Terminate(currentTriple);
            }

            return pls; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:45,代码来源:PermissionListSet.cs

示例2: GetCompressedStack

 [System.Security.SecurityCritical]  // auto-generated
 internal static CompressedStack GetCompressedStack(ref StackCrawlMark stackMark)
 {
     CompressedStack cs;
     CompressedStack innerCS = null;
     if (CodeAccessSecurityEngine.QuickCheckForAllDemands())
     {
         cs = new CompressedStack(null);
         cs.CanSkipEvaluation = true;
     }
     else if (CodeAccessSecurityEngine.AllDomainsHomogeneousWithNoStackModifiers())
     {
         // if all AppDomains on the stack are homogeneous, we don't need to walk the stack
         // however, we do need to capture the AppDomain stack.
         cs = new CompressedStack(GetDelayedCompressedStack(ref stackMark, false));
         cs.m_pls = PermissionListSet.CreateCompressedState_HG();
     }
     else
     {
         // regular stackwalking case
         // We want this to complete without ThreadAborts - if we're in a multiple AD callstack and an intermediate AD gets unloaded,
         // preventing TAs here prevents a race condition where a SafeCompressedStackHandle is created to a DCS belonging to an AD that's 
         // gone away
         cs = new CompressedStack(null);
         RuntimeHelpers.PrepareConstrainedRegions();
         try
         {
             // Empty try block to ensure no ThreadAborts in the finally block
         }
         finally
         {
             
             cs.CompressedStackHandle = GetDelayedCompressedStack(ref stackMark, true);
             if (cs.CompressedStackHandle != null && IsImmediateCompletionCandidate(cs.CompressedStackHandle, out innerCS))
             {
                 try
                 {
                     cs.CompleteConstruction(innerCS);
                 }
                 finally
                 {
                     DestroyDCSList(cs.CompressedStackHandle);
                 }
             }
         }
     }
     return cs;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:48,代码来源:compressedstack.cs

示例3: CreateCompressedState

 internal static PermissionListSet CreateCompressedState(CompressedStack cs, CompressedStack innerCS)
 {
     bool constructionHalted = false;
     if (cs.CompressedStackHandle == null)
     {
         return null;
     }
     PermissionListSet set = new PermissionListSet();
     PermissionSetTriple currentTriple = new PermissionSetTriple();
     for (int i = CompressedStack.GetDCSCount(cs.CompressedStackHandle) - 1; (i >= 0) && !constructionHalted; i--)
     {
         DomainCompressedStack domainCompressedStack = CompressedStack.GetDomainCompressedStack(cs.CompressedStackHandle, i);
         if (domainCompressedStack != null)
         {
             if (domainCompressedStack.PLS == null)
             {
                 throw new SecurityException(string.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("Security_Generic"), new object[0]));
             }
             set.UpdateZoneAndOrigin(domainCompressedStack.PLS);
             set.Update(currentTriple, domainCompressedStack.PLS);
             constructionHalted = domainCompressedStack.ConstructionHalted;
         }
     }
     if (!constructionHalted)
     {
         PermissionListSet pls = null;
         if (innerCS != null)
         {
             innerCS.CompleteConstruction(null);
             pls = innerCS.PLS;
         }
         set.Terminate(currentTriple, pls);
         return set;
     }
     set.Terminate(currentTriple);
     return set;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:37,代码来源:PermissionListSet.cs

示例4: GetCompressedStack

 internal static CompressedStack GetCompressedStack(ref StackCrawlMark stackMark)
 {
     CompressedStack innerCS = null;
     if (CodeAccessSecurityEngine.QuickCheckForAllDemands())
     {
         return new CompressedStack(null) { CanSkipEvaluation = true };
     }
     if (CodeAccessSecurityEngine.AllDomainsHomogeneousWithNoStackModifiers())
     {
         return new CompressedStack(GetDelayedCompressedStack(ref stackMark, false)) { m_pls = PermissionListSet.CreateCompressedState_HG() };
     }
     CompressedStack stack = new CompressedStack(null);
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
     }
     finally
     {
         stack.CompressedStackHandle = GetDelayedCompressedStack(ref stackMark, true);
         if ((stack.CompressedStackHandle != null) && IsImmediateCompletionCandidate(stack.CompressedStackHandle, out innerCS))
         {
             try
             {
                 stack.CompleteConstruction(innerCS);
             }
             finally
             {
                 DestroyDCSList(stack.CompressedStackHandle);
             }
         }
     }
     return stack;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:33,代码来源:CompressedStack.cs

示例5: GetCompressedStack

 internal static CompressedStack GetCompressedStack(ref StackCrawlMark stackMark)
 {
     CompressedStack cs;
     CompressedStack innerCS = null;
     if (CodeAccessSecurityEngine.QuickCheckForAllDemands())
     {
         cs = new CompressedStack(null);
     }
     else if (CodeAccessSecurityEngine.AllDomainsHomogeneousWithNoStackModifiers())
     {
         cs = new CompressedStack(null);
         cs.m_pls = PermissionListSet.CreateCompressedState_HG();
     }
     else
     {
         // regular stackwalking case
         cs = new CompressedStack(GetDelayedCompressedStack( ref stackMark ));
         if (cs.CompressedStackHandle != null && IsImmediateCompletionCandidate(cs.CompressedStackHandle, out innerCS))
         {
             cs.CompleteConstruction(innerCS);
             DestroyDCSList(cs.CompressedStackHandle);
         }
     }
     return cs;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:25,代码来源:compressedstack.cs


注:本文中的System.Threading.CompressedStack.CompleteConstruction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。