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


C# Threading.ExecutionContext类代码示例

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


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


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