private DoCallBackGeneric ( IntPtr targetCtxID, CrossContextDelegate deleg ) : void | ||
targetCtxID | IntPtr | |
deleg | CrossContextDelegate | |
리턴 | 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); } }
public void DoCallBack(CrossContextDelegate deleg) { if (deleg == null) { throw new ArgumentNullException("deleg"); } if ((this._ctxFlags & 2) == 0) { throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_ContextNotFrozenForCallBack")); } Context currentContext = Thread.CurrentContext; if (currentContext == this) { deleg(); return; } currentContext.DoCallBackGeneric(this.InternalContextID, deleg); GC.KeepAlive(this); }