using System;
using System.Runtime.ConstrainedExecution;
namespace System.Threading
{
/// Provides the basic functionality for propagating a synchronization context in various synchronization models.
/// 2
// Token: 0x0200061C RID: 1564
public class SynchronizationContext
{
/// Creates a new instance of the class.
// Token: 0x06003925 RID: 14629 RVA: 0x000C5598 File Offset: 0x000C3798
public SynchronizationContext()
{
}
// Token: 0x06003926 RID: 14630 RVA: 0x000C55A0 File Offset: 0x000C37A0
internal SynchronizationContext(SynchronizationContext context)
{
SynchronizationContext.currentContext = context;
}
/// Gets the synchronization context for the current thread.
/// A object representing the current synchronization context.
/// 1
// Token: 0x17000B0B RID: 2827
// (get) Token: 0x06003927 RID: 14631 RVA: 0x000C55B0 File Offset: 0x000C37B0
public static SynchronizationContext Current
{
get
{
return SynchronizationContext.currentContext;
}
}
/// When overridden in a derived class, creates a copy of the synchronization context.
/// A new object.
/// 2
// Token: 0x06003928 RID: 14632 RVA: 0x000C55B8 File Offset: 0x000C37B8
public virtual SynchronizationContext CreateCopy()
{
return new SynchronizationContext(this);
}
/// Determines if wait notification is required.
/// true if wait notification is required; otherwise, false.
// Token: 0x06003929 RID: 14633 RVA: 0x000C55C0 File Offset: 0x000C37C0
public bool IsWaitNotificationRequired()
{
return this.notification_required;
}
/// When overridden in a derived class, responds to the notification that an operation has completed.
// Token: 0x0600392A RID: 14634 RVA: 0x000C55C8 File Offset: 0x000C37C8
public virtual void OperationCompleted()
{
}
/// When overridden in a derived class, responds to the notification that an operation has started.
// Token: 0x0600392B RID: 14635 RVA: 0x000C55CC File Offset: 0x000C37CC
public virtual void OperationStarted()
{
}
/// When overridden in a derived class, dispatches an asynchronous message to a synchronization context.
/// The delegate to call.
/// The object passed to the delegate.
/// 2
// Token: 0x0600392C RID: 14636 RVA: 0x000C55D0 File Offset: 0x000C37D0
public virtual void Post(SendOrPostCallback d, object state)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(d.Invoke), state);
}
/// When overridden in a derived class, dispatches a synchronous message to a synchronization context.
/// The delegate to call.
/// The object passed to the delegate.
/// 2
// Token: 0x0600392D RID: 14637 RVA: 0x000C55E8 File Offset: 0x000C37E8
public virtual void Send(SendOrPostCallback d, object state)
{
d(state);
}
/// Sets the current synchronization context.
/// The object to be set.
/// 1
///
///
///
// Token: 0x0600392E RID: 14638 RVA: 0x000C55F4 File Offset: 0x000C37F4
public static void SetSynchronizationContext(SynchronizationContext syncContext)
{
SynchronizationContext.currentContext = syncContext;
}
// Token: 0x0600392F RID: 14639 RVA: 0x000C55FC File Offset: 0x000C37FC
[Obsolete]
public static void SetThreadStaticContext(SynchronizationContext syncContext)
{
SynchronizationContext.currentContext = syncContext;
}
/// Sets notification that wait notification is required and prepares the callback method so it can be called more reliably when a wait occurs.
// Token: 0x06003930 RID: 14640 RVA: 0x000C5604 File Offset: 0x000C3804
[MonoTODO]
protected void SetWaitNotificationRequired()
{
this.notification_required = true;
throw new NotImplementedException();
}
/// Waits for any or all the elements in the specified array to receive a signal.
/// The array index of the object that satisfied the wait.
/// An array of type that contains the native operating system handles.
/// true to wait for all handles; false to wait for any handle.
/// The number of milliseconds to wait, or (-1) to wait indefinitely.
/// 2
///
///
///
// Token: 0x06003931 RID: 14641 RVA: 0x000C5614 File Offset: 0x000C3814
[CLSCompliant(false)]
[PrePrepareMethod]
public virtual int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
{
return SynchronizationContext.WaitHelper(waitHandles, waitAll, millisecondsTimeout);
}
/// Helper function that waits for any or all the elements in the specified array to receive a signal.
/// The array index of the object that satisfied the wait.
/// An array of type that contains the native operating system handles.
/// true to wait for all handles; false to wait for any handle.
/// The number of milliseconds to wait, or (-1) to wait indefinitely.
// Token: 0x06003932 RID: 14642 RVA: 0x000C5620 File Offset: 0x000C3820
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[PrePrepareMethod]
[CLSCompliant(false)]
[MonoTODO]
protected static int WaitHelper(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
{
throw new NotImplementedException();
}
// Token: 0x0400170C RID: 5900
private bool notification_required;
// Token: 0x0400170D RID: 5901
[ThreadStatic]
private static SynchronizationContext currentContext;
}
}