當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。