zoukankan      html  css  js  c++  java
  • C# 调用线程并行上下文穿透-ILogicalThreadAffinative+CallContext

    na


    mespace System.Runtime.Remoting.Messaging { /// <summary>Provides a set of properties that are carried with the execution code path. This class cannot be inherited.</summary> // Token: 0x0200085D RID: 2141 [SecurityCritical] [ComVisible(true)] [Serializable] public sealed class CallContext /// <summary>Stores a given object and associates it with the specified name.</summary> /// <param name="name">The name with which to associate the new item in the call context. </param> /// <param name="data">The object to store in the call context. </param> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> // Token: 0x06005B36 RID: 23350 RVA: 0x0013EAFC File Offset: 0x0013CCFC [SecurityCritical] public static void SetData(string name, object data) { if (data is ILogicalThreadAffinative) { CallContext.LogicalSetData(name, data); return; } ExecutionContext mutableExecutionContext = Thread.CurrentThread.GetMutableExecutionContext(); mutableExecutionContext.LogicalCallContext.FreeNamedDataSlot(name); mutableExecutionContext.IllogicalCallContext.SetData(name, data); } /// <summary>Stores a given object in the logical call context and associates it with the specified name.</summary> /// <param name="name">The name with which to associate the new item in the logical call context. </param> /// <param name="data">The object to store in the logical call context, this object must be serializable. </param> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> // Token: 0x06005B37 RID: 23351 RVA: 0x0013EB40 File Offset: 0x0013CD40 [SecurityCritical] public static void LogicalSetData(string name, object data) { ExecutionContext mutableExecutionContext = Thread.CurrentThread.GetMutableExecutionContext(); mutableExecutionContext.IllogicalCallContext.FreeNamedDataSlot(name); mutableExecutionContext.LogicalCallContext.SetData(name, data); }

      

  • 相关阅读:
    MySQL Limit优化(转)
    MySQL数据库性能优化思路与解决方法(一转)
    Mysql占用CPU过高如何优化?(转)
    数据库方面两个简单实用的优化方法(转)
    硬盘扩容9999T
    python内涵段子爬取练习
    jmeter环境配置
    PyCharm3.0默认快捷键
    python3 操作页面上各种元素的方法
    python3 selenium webdriver 元素定位xpath定位骚操作
  • 原文地址:https://www.cnblogs.com/micro-chen/p/10297503.html
Copyright © 2011-2022 走看看