本文整理汇总了C#中System.Threading.CompressedStack类的典型用法代码示例。如果您正苦于以下问题:C# CompressedStack类的具体用法?C# CompressedStack怎么用?C# CompressedStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompressedStack类属于System.Threading命名空间,在下文中一共展示了CompressedStack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run(CompressedStack compressedStack, ContextCallback callback, object state)
{
if (compressedStack == null)
{
throw new ArgumentNullException(nameof(compressedStack));
}
// The original code was not checking for a null callback and would throw NullReferenceException
callback(state);
}
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:CompressedStack.cs
示例2: Undo
public void Undo ()
{
if ((_cs != null) && (_t != null)) {
lock (_cs) {
if ((_cs != null) && (_t != null)) {
_t.SetCompressedStack (_cs);
}
_t = null;
_cs = null;
}
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:CompressedStackSwitcher.cs
示例3: Capture
static CompressedStack Capture ()
{
CompressedStack cs = new CompressedStack (0);
cs._list = SecurityFrame.GetStack (1);
// include any current CompressedStack inside the new Capture
CompressedStack currentCs = Thread.CurrentThread.GetCompressedStack ();
if (currentCs != null) {
for (int i=0; i < currentCs._list.Count; i++)
cs._list.Add (currentCs._list [i]);
}
return cs;
}
开发者ID:runefs,项目名称:Marvin,代码行数:13,代码来源:CompressedStack.cs
示例4: CompleteConstruction
internal void CompleteConstruction(CompressedStack innerCS)
{
if (this.PLS == null)
{
PermissionListSet set = PermissionListSet.CreateCompressedState(this, innerCS);
lock (this)
{
if (this.PLS == null)
{
this.m_pls = set;
}
}
}
}
开发者ID:randomize,项目名称:VimConfig,代码行数:14,代码来源:CompressedStack.cs
示例5: Undo
public void Undo()
{
if ((this.curr_CS != null) || (this.prev_CS != null))
{
if (this.prev_ADStack != IntPtr.Zero)
{
CompressedStack.RestoreAppDomainStack(this.prev_ADStack);
}
CompressedStack.SetCompressedStackThread(this.prev_CS);
this.prev_CS = null;
this.curr_CS = null;
this.prev_ADStack = IntPtr.Zero;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:CompressedStackSwitcher.cs
示例6: Capture
public static CompressedStack Capture ()
{
#if !FEATURE_COMPRESSEDSTACK
throw new NotSupportedException ();
#else
CompressedStack cs = new CompressedStack (0);
cs._list = new ArrayList ();
// include any current CompressedStack inside the new Capture
CompressedStack currentCs = Thread.CurrentThread.ExecutionContext.SecurityContext.CompressedStack;
if (currentCs != null) {
for (int i=0; i < currentCs._list.Count; i++)
cs._list.Add (currentCs._list [i]);
}
return cs;
#endif
}
开发者ID:Profit0004,项目名称:mono,代码行数:17,代码来源:CompressedStack.cs
示例7: CheckHelper
[System.Security.SecurityCritical] // auto-generated
internal static void CheckHelper(CompressedStack cs,
PermissionSet grantedSet,
PermissionSet refusedSet,
CodeAccessPermission demand,
PermissionToken permToken,
RuntimeMethodHandleInternal rmh,
RuntimeAssembly asm,
SecurityAction action)
{
if (cs != null)
cs.CheckDemand(demand, permToken, rmh);
else
CheckHelper(grantedSet, refusedSet, demand, permToken, rmh, (Object)asm, action, true);
}
开发者ID:uQr,项目名称:referencesource,代码行数:15,代码来源:codeaccesssecurityengine.cs
示例8: CheckSetHelper
[System.Security.SecurityCritical] // auto-generated
internal static void CheckSetHelper(CompressedStack cs,
PermissionSet grants,
PermissionSet refused,
PermissionSet demands,
RuntimeMethodHandleInternal rmh,
RuntimeAssembly asm,
SecurityAction action)
{
if (cs != null)
cs.CheckSetDemand(demands, rmh);
else
CheckSetHelper(grants, refused, demands, rmh, (Object)asm, action, true);
}
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:codeaccesssecurityengine.cs
示例9: XmlTextReaderImpl
public XmlTextReaderImpl( string url, XmlNameTable nt ): this( nt ) {
if ( url == null ) {
throw new ArgumentNullException( "url" );
}
if ( url.Length == 0 ) {
throw new ArgumentException( Res.GetString( Res.Xml_EmptyUrl ), "url" );
}
namespaceManager = new XmlNamespaceManager( nt );
compressedStack = CompressedStack.Capture();
this.url = url;
ps.baseUri = xmlResolver.ResolveUri( null, url );
ps.baseUriStr = ps.baseUri.ToString();
reportedBaseUri = ps.baseUriStr;
parsingFunction = ParsingFunction.OpenUrl;
}
开发者ID:JianwenSun,项目名称:cc,代码行数:19,代码来源:XmlTextReaderImpl.cs
示例10: SetCompressedStack
public void SetCompressedStack (CompressedStack stack)
{
#if MOBILE
throw new NotSupportedException ();
#else
ExecutionContext.SecurityContext.CompressedStack = stack;
#endif
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:Thread.cs
示例11: CompressedStack
internal CompressedStack (CompressedStack cs)
{
if ((cs != null) && (cs._list != null))
_list = (ArrayList) cs._list.Clone ();
}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:CompressedStack.cs
示例12: IsImmediateCompletionCandidate
internal extern static bool IsImmediateCompletionCandidate(SafeCompressedStackHandle compressedStack, out CompressedStack innerCS);
开发者ID:uQr,项目名称:referencesource,代码行数:1,代码来源:compressedstack.cs
示例13: Run
public static void Run(CompressedStack compressedStack, ContextCallback callback, Object state)
{
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:3,代码来源:System.Threading.CompressedStack.cs
示例14: SetCompressedStack
public void SetCompressedStack(CompressedStack stack)
{
Contract.Ensures(false);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:4,代码来源:System.Threading.Thread.cs
示例15: Init
[System.Security.SecurityCritical] // auto-generated
private unsafe void Init(String name,
MethodAttributes attributes,
CallingConventions callingConvention,
Type returnType,
Type[] signature,
Type owner,
Module m,
bool skipVisibility,
bool transparentMethod,
ref StackCrawlMark stackMark)
{
DynamicMethod.CheckConsistency(attributes, callingConvention);
// check and store the signature
if (signature != null) {
m_parameterTypes = new RuntimeType[signature.Length];
for (int i = 0; i < signature.Length; i++) {
if (signature[i] == null)
throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature"));
m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType;
if ( m_parameterTypes[i] == null || !(m_parameterTypes[i] is RuntimeType) || m_parameterTypes[i] == (RuntimeType)typeof(void) )
throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature"));
}
}
else {
m_parameterTypes = Array.Empty<RuntimeType>();
}
// check and store the return value
m_returnType = (returnType == null) ? (RuntimeType)typeof(void) : returnType.UnderlyingSystemType as RuntimeType;
if ( (m_returnType == null) || !(m_returnType is RuntimeType) || m_returnType.IsByRef )
throw new NotSupportedException(Environment.GetResourceString("Arg_InvalidTypeInRetType"));
if (transparentMethod)
{
Contract.Assert(owner == null && m == null, "owner and m cannot be set for transparent methods");
m_module = GetDynamicMethodsModule();
if (skipVisibility)
{
m_restrictedSkipVisibility = true;
}
#if FEATURE_COMPRESSEDSTACK
m_creationContext = CompressedStack.Capture();
#endif // FEATURE_COMPRESSEDSTACK
}
else
{
Contract.Assert(m != null || owner != null, "PerformSecurityCheck should ensure that either m or owner is set");
Contract.Assert(m == null || !m.Equals(s_anonymouslyHostedDynamicMethodsModule), "The user cannot explicitly use this assembly");
Contract.Assert(m == null || owner == null, "m and owner cannot both be set");
if (m != null)
m_module = m.ModuleHandle.GetRuntimeModule(); // this returns the underlying module for all RuntimeModule and ModuleBuilder objects.
else
{
RuntimeType rtOwner = null;
if (owner != null)
rtOwner = owner.UnderlyingSystemType as RuntimeType;
if (rtOwner != null)
{
if (rtOwner.HasElementType || rtOwner.ContainsGenericParameters
|| rtOwner.IsGenericParameter || rtOwner.IsInterface)
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTypeForDynamicMethod"));
m_typeOwner = rtOwner;
m_module = rtOwner.GetRuntimeModule();
}
}
m_skipVisibility = skipVisibility;
}
// initialize remaining fields
m_ilGenerator = null;
m_fInitLocals = true;
m_methodHandle = null;
if (name == null)
throw new ArgumentNullException("name");
#if FEATURE_APPX
if (AppDomain.ProfileAPICheck)
{
if (m_creatorAssembly == null)
m_creatorAssembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark);
if (m_creatorAssembly != null && !m_creatorAssembly.IsFrameworkAssembly())
m_profileAPICheck = true;
}
#endif // FEATURE_APPX
m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention);
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:96,代码来源:DynamicMethod.cs
示例16: Equals
// internal stuff
internal bool Equals (CompressedStack cs)
{
if (IsEmpty ())
return cs.IsEmpty ();
if (cs.IsEmpty ())
return false;
if (_list.Count != cs._list.Count)
return false;
for (int i=0; i < _list.Count; i++) {
SecurityFrame sf1 = (SecurityFrame) _list [i];
SecurityFrame sf2 = (SecurityFrame) cs._list [i];
if (!sf1.Equals (sf2))
return false;
}
return true;
}
开发者ID:runefs,项目名称:Marvin,代码行数:19,代码来源:CompressedStack.cs
示例17: Run
static public void Run (CompressedStack compressedStack, ContextCallback callback, object state)
{
if (compressedStack == null)
throw new ArgumentException ("compressedStack");
Thread t = Thread.CurrentThread;
CompressedStack original = null;
try {
original = t.GetCompressedStack ();
t.SetCompressedStack (compressedStack);
callback (state);
}
finally {
if (original != null)
t.SetCompressedStack (original);
}
}
开发者ID:runefs,项目名称:Marvin,代码行数:17,代码来源:CompressedStack.cs
示例18: SetCompressedStack
public void SetCompressedStack(CompressedStack stack)
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ThreadAPIsNotSupported"));
}
开发者ID:randomize,项目名称:VimConfig,代码行数:4,代码来源:Thread.cs
示例19: ReflectionTargetDemandHelper
[System.Security.SecurityCritical] // auto-generated
private static void ReflectionTargetDemandHelper(int permission,
PermissionSet targetGrant,
CompressedStack securityContext)
{
Contract.Assert(securityContext != null, "securityContext != null");
// We need to remove all identity permissions from the grant set of the target, otherwise the
// disjunctive demand will fail unless we're reflecting on the same assembly.
PermissionSet demandSet = null;
if (targetGrant == null)
{
demandSet = new PermissionSet(PermissionState.Unrestricted);
}
else
{
demandSet = targetGrant.CopyWithNoIdentityPermissions();
demandSet.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
}
securityContext.DemandFlagsOrGrantSet((1 << (int)permission), demandSet);
}
开发者ID:uQr,项目名称:referencesource,代码行数:22,代码来源:codeaccesssecurityengine.cs
示例20: Undo
public void Undo()
{
if (curr_CS == null && prev_CS == null)
return;
if (prev_ADStack != (IntPtr)0)
CompressedStack.RestoreAppDomainStack(prev_ADStack);
CompressedStack.SetCompressedStackThread(prev_CS);
prev_CS = null;
curr_CS = null;
prev_ADStack = (IntPtr)0;
}
开发者ID:uQr,项目名称:referencesource,代码行数:12,代码来源:compressedstack.cs
注:本文中的System.Threading.CompressedStack类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论