• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Threading.ExecutionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ExecutionContext类属于System.Threading命名空间,在下文中一共展示了ExecutionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Setup

 internal void Setup()
 {
     this.useEC = true;
     this._ec = Thread.CurrentThread.ExecutionContext;
     this._ec.isFlowSuppressed = true;
     this._thread = Thread.CurrentThread;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:AsyncFlowControl.cs


示例2: ExecutionContext

		internal ExecutionContext (ExecutionContext ec)
		{
			if (ec._sc != null)
				_sc = new SecurityContext (ec._sc);
			_suppressFlow = ec._suppressFlow;
			_capture = true;
		}
开发者ID:ramonsmits,项目名称:mono,代码行数:7,代码来源:ExecutionContext.cs


示例3: AsyncResult

	internal AsyncResult (WaitCallback cb, object state, bool capture_context)
	{
		async_state = state;
		async_delegate = cb;
		if (capture_context)
			current = ExecutionContext.Capture ();
	}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:AsyncResult.cs


示例4: CimAsyncCallbacksReceiverBase

		protected CimAsyncCallbacksReceiverBase()
		{
			this._operationLock = new object();
			this._operationPendingActions = new List<Action<CimOperation>>();
			this._suppressFurtherUserCallbacksLock = new object();
			this._threadExecutionContext = ExecutionContext.Capture();
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:CimAsyncCallbacksReceiverBase.cs


示例5: _IOCompletionCallback

 internal _IOCompletionCallback(IOCompletionCallback ioCompletionCallback, ref StackCrawlMark stackMark)
 {
     _ioCompletionCallback = ioCompletionCallback;
     // clone the exection context
     _executionContext = ExecutionContext.Capture(ref stackMark);
     ExecutionContext.ClearSyncContext(_executionContext);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:7,代码来源:overlapped.cs


示例6: Capture

 internal static ExecutionContext Capture(ref StackCrawlMark stackMark)
 {
     if (IsFlowSuppressed())
     {
         return null;
     }
     ExecutionContext executionContextNoCreate = System.Threading.Thread.CurrentThread.GetExecutionContextNoCreate();
     ExecutionContext context2 = new ExecutionContext {
         isNewCapture = true,
         SecurityContext = System.Security.SecurityContext.Capture(executionContextNoCreate, ref stackMark)
     };
     if (context2.SecurityContext != null)
     {
         context2.SecurityContext.ExecutionContext = context2;
     }
     context2._hostExecutionContext = HostExecutionContextManager.CaptureHostExecutionContext();
     if (executionContextNoCreate != null)
     {
         context2._syncContext = (executionContextNoCreate._syncContext == null) ? null : executionContextNoCreate._syncContext.CreateCopy();
         if (executionContextNoCreate._logicalCallContext != null)
         {
             System.Runtime.Remoting.Messaging.LogicalCallContext logicalCallContext = executionContextNoCreate.LogicalCallContext;
             context2.LogicalCallContext = (System.Runtime.Remoting.Messaging.LogicalCallContext) logicalCallContext.Clone();
         }
     }
     return context2;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:27,代码来源:ExecutionContext.cs


示例7: Undo

 public void Undo()
 {
     if (this.currEC != null)
     {
         if (this.currEC != Thread.CurrentThread.GetExecutionContextNoCreate())
         {
             Environment.FailFast(Environment.GetResourceString("InvalidOperation_SwitcherCtxMismatch"));
         }
         if (this.currSC != this.currEC.SecurityContext)
         {
             Environment.FailFast(Environment.GetResourceString("InvalidOperation_SwitcherCtxMismatch"));
         }
         this.currEC.SecurityContext = this.prevSC;
         this.currEC = null;
         bool flag = true;
         try
         {
             if (this.wic != null)
             {
                 flag &= this.wic.UndoNoThrow();
             }
         }
         catch
         {
             flag &= this.cssw.UndoNoThrow();
             Environment.FailFast(Environment.GetResourceString("ExecutionContext_UndoFailed"));
         }
         if (!(flag & this.cssw.UndoNoThrow()))
         {
             Environment.FailFast(Environment.GetResourceString("ExecutionContext_UndoFailed"));
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:SecurityContextSwitcher.cs


示例8: WrapResultDelegate

 static ResultDelegate WrapResultDelegate(ExecutionContext context, ResultDelegate result)
 {
     return (status, headers, body) => result(
         status,
         headers,
         WrapBodyDelegate(context, body));
 }
开发者ID:markrendle,项目名称:gate,代码行数:7,代码来源:ExecutionContextPerRequest.cs


示例9: TlsStream

        //
        // This version of an Ssl Stream is for internal HttpWebrequest use.
        // This Ssl client owns the underlined socket
        // The TlsStream will own secured read/write and disposal of the passed "networkStream" stream.
        //
        public TlsStream(string destinationHost, NetworkStream networkStream, X509CertificateCollection clientCertificates, ServicePoint servicePoint, object initiatingRequest, ExecutionContext executionContext)
               :base(networkStream, true) {

        // WebRequest manages the execution context manually so we have to ensure we get one for SSL client certificate demand
        _ExecutionContext = executionContext;
        if (_ExecutionContext == null)
        {
            _ExecutionContext = ExecutionContext.Capture();
        }

        // 


         GlobalLog.Enter("TlsStream::TlsStream", "host="+destinationHost+", #certs="+((clientCertificates == null) ? "none" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo)));
         if (Logging.On) Logging.PrintInfo(Logging.Web, this, ".ctor", "host="+destinationHost+", #certs="+((clientCertificates == null) ? "null" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo)));

         m_ExceptionStatus = WebExceptionStatus.SecureChannelFailure;
         m_Worker = new SslState(networkStream, initiatingRequest is HttpWebRequest, SettingsSectionInternal.Section.EncryptionPolicy);

         m_DestinationHost = destinationHost;
         m_ClientCertificates = clientCertificates;

         RemoteCertValidationCallback certValidationCallback = servicePoint.SetupHandshakeDoneProcedure(this, initiatingRequest);
         m_Worker.SetCertValidationDelegate(certValidationCallback);

         // The Handshake is NOT done at this point
         GlobalLog.Leave("TlsStream::TlsStream (Handshake is not done)");
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:33,代码来源:_TLSstream.cs


示例10: SynchronizationContextSwitcher

 public SynchronizationContextSwitcher(SynchronizationContext context)
 {
     _newContext = context;
     _executionContext = Thread.CurrentThread.ExecutionContext;
     _oldContext = SynchronizationContext.Current;
     SynchronizationContext.SetSynchronizationContext(context);
 }
开发者ID:BorisMomtchev,项目名称:NiCris.Starter,代码行数:7,代码来源:SynchronizationContextSwitcher.cs


示例11: WorkItem

		public WorkItem(WorkItemId taskID, WaitCallback wc, IAsyncResult state, ExecutionContext ctx)
		{
			_callback = wc;
			_state = state;
			_ctx = ctx;
			_taskID = taskID;
		}
开发者ID:koder05,项目名称:fogel-ba,代码行数:7,代码来源:WorkItem.cs


示例12: WrapBodyDelegate

 static BodyDelegate WrapBodyDelegate(ExecutionContext context, BodyDelegate body)
 {
     return body == null ? (BodyDelegate)null : (write, flush, end, cancellationToken) => ExecutionContext.Run(
         context.CreateCopy(),
         _ => body(write, WrapFlushDelegate(context, flush), end, cancellationToken),
         null);
 }
开发者ID:markrendle,项目名称:gate,代码行数:7,代码来源:ExecutionContextPerRequest.cs


示例13: ClearSyncContext

 internal static void ClearSyncContext(ExecutionContext ec)
 {
     if (ec != null)
     {
         ec.SynchronizationContext = null;
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:ExecutionContext.cs


示例14: CancellationCallbackInfo

 internal CancellationCallbackInfo(Action<object> callback, object stateForCallback, SynchronizationContext targetSyncContext, ExecutionContext targetExecutionContext, System.Threading.CancellationTokenSource cancellationTokenSource)
 {
     this.Callback = callback;
     this.StateForCallback = stateForCallback;
     this.TargetSyncContext = targetSyncContext;
     this.TargetExecutionContext = targetExecutionContext;
     this.CancellationTokenSource = cancellationTokenSource;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:CancellationCallbackInfo.cs


示例15: CancellationCallbackInfo

 internal CancellationCallbackInfo(Action<object> callback, object stateForCallback, SynchronizationContext targetSyncContext, ExecutionContext targetExecutionContext, CancellationTokenSource cancellationTokenSource)
 {
     Callback = callback;
     StateForCallback = stateForCallback;
     TargetSyncContext = targetSyncContext;
     TargetExecutionContext = targetExecutionContext;
     CancellationTokenSource = cancellationTokenSource;
 }
开发者ID:BclEx,项目名称:BclEx-Extend,代码行数:8,代码来源:CancellationCallbackInfo.cs


示例16: Restore

			public void Restore (ExecutionContext ec)
			{
				ec._lcc = this._lcc;
				ec._suppressFlow = this._suppressFlow;
				ec._capture = this._capture;
				ec.local_data = this.local_data;
				ec.CopyOnWrite = this.copy_on_write;
			}
开发者ID:genoher,项目名称:mono,代码行数:8,代码来源:ExecutionContext.cs


示例17: WrapCallbackDelegate

 static Action<ResultParameters, Exception> WrapCallbackDelegate(ExecutionContext context, Action<ResultParameters, Exception> callback)
 {
     return (result, error) =>
     {
         result.Body = WrapBodyDelegate(context, result.Body);
         callback(result, error);
     };
 }
开发者ID:anurse,项目名称:gate,代码行数:8,代码来源:ExecutionContextPerRequest.cs


示例18: _IOCompletionCallback

 internal _IOCompletionCallback(IOCompletionCallback ioCompletionCallback, ref StackCrawlMark stackMark)
 {
     _ioCompletionCallback = ioCompletionCallback;
     // clone the exection context
     _executionContext = ExecutionContext.Capture(
         ref stackMark, 
         ExecutionContext.CaptureOptions.IgnoreSyncCtx | ExecutionContext.CaptureOptions.OptimizeDefaultCase);
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:8,代码来源:Overlapped.cs


示例19: CallbackClosure

 internal CallbackClosure(ExecutionContext context, AsyncCallback callback)
 {
     if (callback != null)
     {
         _savedCallback = callback;
         _savedContext = context;
     }
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:8,代码来源:ContextAwareResult.cs


示例20: QueueUserWorkItemCallback

 internal QueueUserWorkItemCallback(WaitCallback waitCallback, object stateObj, bool compressStack, ref StackCrawlMark stackMark)
 {
     this.callback = waitCallback;
     this.state = stateObj;
     if (compressStack && !ExecutionContext.IsFlowSuppressed())
     {
         this.context = ExecutionContext.Capture(ref stackMark, ExecutionContext.CaptureOptions.OptimizeDefaultCase | ExecutionContext.CaptureOptions.IgnoreSyncCtx);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:QueueUserWorkItemCallback.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Threading.InternalThread类代码示例发布时间:2022-05-26
下一篇:
C# Threading.EventWaitHandle类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap