245 lines
7.7 KiB
C#
245 lines
7.7 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading;
|
|
|
|
namespace System.Runtime.Remoting.Messaging
|
|
{
|
|
/// <summary>Encapsulates the results of an asynchronous operation on a delegate.</summary>
|
|
// Token: 0x020003D8 RID: 984
|
|
[ComVisible(true)]
|
|
public class AsyncResult : IAsyncResult, IMessageSink
|
|
{
|
|
// Token: 0x06002697 RID: 9879 RVA: 0x0007F13C File Offset: 0x0007D33C
|
|
internal AsyncResult()
|
|
{
|
|
}
|
|
|
|
/// <summary>Gets the object provided as the last parameter of a BeginInvoke method call.</summary>
|
|
/// <returns>The object provided as the last parameter of a BeginInvoke method call.</returns>
|
|
// Token: 0x1700073A RID: 1850
|
|
// (get) Token: 0x06002698 RID: 9880 RVA: 0x0007F144 File Offset: 0x0007D344
|
|
public virtual object AsyncState
|
|
{
|
|
get
|
|
{
|
|
return this.async_state;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a <see cref="T:System.Threading.WaitHandle" /> that encapsulates Win32 synchronization handles, and allows the implementation of various synchronization schemes.</summary>
|
|
/// <returns>A <see cref="T:System.Threading.WaitHandle" /> that encapsulates Win32 synchronization handles, and allows the implementation of various synchronization schemes.</returns>
|
|
// Token: 0x1700073B RID: 1851
|
|
// (get) Token: 0x06002699 RID: 9881 RVA: 0x0007F14C File Offset: 0x0007D34C
|
|
public virtual WaitHandle AsyncWaitHandle
|
|
{
|
|
get
|
|
{
|
|
WaitHandle waitHandle;
|
|
lock (this)
|
|
{
|
|
if (this.handle == null)
|
|
{
|
|
this.handle = new ManualResetEvent(this.completed);
|
|
}
|
|
waitHandle = this.handle;
|
|
}
|
|
return waitHandle;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether the BeginInvoke call completed synchronously.</summary>
|
|
/// <returns>true if the BeginInvoke call completed synchronously; otherwise, false.</returns>
|
|
// Token: 0x1700073C RID: 1852
|
|
// (get) Token: 0x0600269A RID: 9882 RVA: 0x0007F1B4 File Offset: 0x0007D3B4
|
|
public virtual bool CompletedSynchronously
|
|
{
|
|
get
|
|
{
|
|
return this.sync_completed;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether the server has completed the call.</summary>
|
|
/// <returns>true after the server has completed the call; otherwise, false.</returns>
|
|
// Token: 0x1700073D RID: 1853
|
|
// (get) Token: 0x0600269B RID: 9883 RVA: 0x0007F1BC File Offset: 0x0007D3BC
|
|
public virtual bool IsCompleted
|
|
{
|
|
get
|
|
{
|
|
return this.completed;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets a value indicating whether EndInvoke has been called on the current <see cref="T:System.Runtime.Remoting.Messaging.AsyncResult" />.</summary>
|
|
/// <returns>true if EndInvoke has been called on the current <see cref="T:System.Runtime.Remoting.Messaging.AsyncResult" />; otherwise, false.</returns>
|
|
// Token: 0x1700073E RID: 1854
|
|
// (get) Token: 0x0600269C RID: 9884 RVA: 0x0007F1C4 File Offset: 0x0007D3C4
|
|
// (set) Token: 0x0600269D RID: 9885 RVA: 0x0007F1CC File Offset: 0x0007D3CC
|
|
public bool EndInvokeCalled
|
|
{
|
|
get
|
|
{
|
|
return this.endinvoke_called;
|
|
}
|
|
set
|
|
{
|
|
this.endinvoke_called = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the delegate object on which the asynchronous call was invoked.</summary>
|
|
/// <returns>The delegate object on which the asynchronous call was invoked.</returns>
|
|
// Token: 0x1700073F RID: 1855
|
|
// (get) Token: 0x0600269E RID: 9886 RVA: 0x0007F1D8 File Offset: 0x0007D3D8
|
|
public virtual object AsyncDelegate
|
|
{
|
|
get
|
|
{
|
|
return this.async_delegate;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the next message sink in the sink chain.</summary>
|
|
/// <returns>An <see cref="T:System.Runtime.Remoting.Messaging.IMessageSink" /> interface that represents the next message sink in the sink chain.</returns>
|
|
// Token: 0x17000740 RID: 1856
|
|
// (get) Token: 0x0600269F RID: 9887 RVA: 0x0007F1E0 File Offset: 0x0007D3E0
|
|
public IMessageSink NextSink
|
|
{
|
|
get
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>Implements the <see cref="T:System.Runtime.Remoting.Messaging.IMessageSink" /> interface.</summary>
|
|
/// <returns>No value is returned.</returns>
|
|
/// <param name="msg">The request <see cref="T:System.Runtime.Remoting.Messaging.IMessage" /> interface. </param>
|
|
/// <param name="replySink">The response <see cref="T:System.Runtime.Remoting.Messaging.IMessageSink" /> interface. </param>
|
|
// Token: 0x060026A0 RID: 9888 RVA: 0x0007F1E4 File Offset: 0x0007D3E4
|
|
public virtual IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
/// <summary>Gets the response message for the asynchronous call.</summary>
|
|
/// <returns>A remoting message that should represent a response to a method call on a remote object.</returns>
|
|
// Token: 0x060026A1 RID: 9889 RVA: 0x0007F1EC File Offset: 0x0007D3EC
|
|
public virtual IMessage GetReplyMessage()
|
|
{
|
|
return this.reply_message;
|
|
}
|
|
|
|
/// <summary>Sets an <see cref="T:System.Runtime.Remoting.Messaging.IMessageCtrl" /> for the current remote method call, which provides a way to control asynchronous messages after they have been dispatched.</summary>
|
|
/// <param name="mc">The <see cref="T:System.Runtime.Remoting.Messaging.IMessageCtrl" /> for the current remote method call. </param>
|
|
// Token: 0x060026A2 RID: 9890 RVA: 0x0007F1F4 File Offset: 0x0007D3F4
|
|
public virtual void SetMessageCtrl(IMessageCtrl mc)
|
|
{
|
|
this.message_ctrl = mc;
|
|
}
|
|
|
|
// Token: 0x060026A3 RID: 9891 RVA: 0x0007F200 File Offset: 0x0007D400
|
|
internal void SetCompletedSynchronously(bool completed)
|
|
{
|
|
this.sync_completed = completed;
|
|
}
|
|
|
|
// Token: 0x060026A4 RID: 9892 RVA: 0x0007F20C File Offset: 0x0007D40C
|
|
internal IMessage EndInvoke()
|
|
{
|
|
lock (this)
|
|
{
|
|
if (this.completed)
|
|
{
|
|
return this.reply_message;
|
|
}
|
|
}
|
|
this.AsyncWaitHandle.WaitOne();
|
|
return this.reply_message;
|
|
}
|
|
|
|
/// <summary>Synchronously processes a response message returned by a method call on a remote object.</summary>
|
|
/// <returns>Returns null.</returns>
|
|
/// <param name="msg">A response message to a method call on a remote object.</param>
|
|
// Token: 0x060026A5 RID: 9893 RVA: 0x0007F274 File Offset: 0x0007D474
|
|
public virtual IMessage SyncProcessMessage(IMessage msg)
|
|
{
|
|
this.reply_message = msg;
|
|
lock (this)
|
|
{
|
|
this.completed = true;
|
|
if (this.handle != null)
|
|
{
|
|
((ManualResetEvent)this.AsyncWaitHandle).Set();
|
|
}
|
|
}
|
|
if (this.async_callback != null)
|
|
{
|
|
AsyncCallback asyncCallback = (AsyncCallback)this.async_callback;
|
|
asyncCallback(this);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x17000741 RID: 1857
|
|
// (get) Token: 0x060026A6 RID: 9894 RVA: 0x0007F2FC File Offset: 0x0007D4FC
|
|
// (set) Token: 0x060026A7 RID: 9895 RVA: 0x0007F304 File Offset: 0x0007D504
|
|
internal MonoMethodMessage CallMessage
|
|
{
|
|
get
|
|
{
|
|
return this.call_message;
|
|
}
|
|
set
|
|
{
|
|
this.call_message = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000F11 RID: 3857
|
|
private object async_state;
|
|
|
|
// Token: 0x04000F12 RID: 3858
|
|
private WaitHandle handle;
|
|
|
|
// Token: 0x04000F13 RID: 3859
|
|
private object async_delegate;
|
|
|
|
// Token: 0x04000F14 RID: 3860
|
|
private IntPtr data;
|
|
|
|
// Token: 0x04000F15 RID: 3861
|
|
private object object_data;
|
|
|
|
// Token: 0x04000F16 RID: 3862
|
|
private bool sync_completed;
|
|
|
|
// Token: 0x04000F17 RID: 3863
|
|
private bool completed;
|
|
|
|
// Token: 0x04000F18 RID: 3864
|
|
private bool endinvoke_called;
|
|
|
|
// Token: 0x04000F19 RID: 3865
|
|
private object async_callback;
|
|
|
|
// Token: 0x04000F1A RID: 3866
|
|
private ExecutionContext current;
|
|
|
|
// Token: 0x04000F1B RID: 3867
|
|
private ExecutionContext original;
|
|
|
|
// Token: 0x04000F1C RID: 3868
|
|
private int gchandle;
|
|
|
|
// Token: 0x04000F1D RID: 3869
|
|
private MonoMethodMessage call_message;
|
|
|
|
// Token: 0x04000F1E RID: 3870
|
|
private IMessageCtrl message_ctrl;
|
|
|
|
// Token: 0x04000F1F RID: 3871
|
|
private IMessage reply_message;
|
|
}
|
|
}
|