System.Runtime.Remoting.Contexts.Context.DoCallBack C# (CSharp) Méthode

DoCallBack() private méthode

private DoCallBack ( CrossContextDelegate deleg ) : void
deleg CrossContextDelegate
Résultat void
        public void DoCallBack(CrossContextDelegate deleg)
        {
            /*DBG Console.WriteLine("public DoCallBack: targetCtx: " 
            + Int32.Format(this.InternalContextID,"x")); DBG*/
                
            if (deleg == null)
            {
                throw new ArgumentNullException("deleg");
            }

            if ((_ctxFlags & CTX_FROZEN) == 0)
            {
                throw new RemotingException( 
                    Environment.GetResourceString(
                        "Remoting_Contexts_ContextNotFrozenForCallBack"));
            }

            Context currCtx = Thread.CurrentContext;
            if (currCtx == this)
            {
                // We are already in the target context, just execute deleg
                // NOTE: If in the future we decide to leave the context
                // and reenter it for this case we will need to change 
                // Context::RequestCallBack method in VM also!
                deleg();
            }
            else
            {                               
                // We pass 0 for target domain ID for x-context case.
                currCtx.DoCallBackGeneric(this.InternalContextID, deleg);
                GC.KeepAlive(this);
            }
        }

Usage Example

Exemple #1
0
		public void TestDoCallback ()
		{
			otherCtx = cbo.GetContext ();
			Assert.IsTrue (Thread.CurrentContext != otherCtx, "New context not created");
			
			otherCtx.DoCallBack (new CrossContextDelegate (DelegateTarget));
		}
All Usage Examples Of System.Runtime.Remoting.Contexts.Context::DoCallBack