Inheritance: ContextBoundObject
Exemple #1
0
 /// <summary>Executes code in another context.</summary>
 /// <param name="deleg">The delegate used to request the callback. </param>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
 /// </PermissionSet>
 public void DoCallBack(CrossContextDelegate deleg)
 {
     lock (this)
     {
         if (this.callback_object == null)
         {
             Context newContext = Context.SwitchToContext(this);
             this.callback_object = new ContextCallbackObject();
             Context.SwitchToContext(newContext);
         }
     }
     this.callback_object.DoCallBack(deleg);
 }
Exemple #2
0
		public void DoCallBack (CrossContextDelegate deleg)
		{
			lock (this)
			{
				if (callback_object == null) {
					Context oldContext = Context.SwitchToContext (this);
					callback_object = new ContextCallbackObject ();
					Context.SwitchToContext (oldContext);
				}
			}
			
			callback_object.DoCallBack (deleg);
		}