This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,152 @@
using System;
using System.Runtime.ConstrainedExecution;
namespace System.Threading
{
/// <summary>Provides the basic functionality for propagating a synchronization context in various synchronization models. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200061C RID: 1564
public class SynchronizationContext
{
/// <summary>Creates a new instance of the <see cref="T:System.Threading.SynchronizationContext" /> class.</summary>
// 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;
}
/// <summary>Gets the synchronization context for the current thread.</summary>
/// <returns>A <see cref="T:System.Threading.SynchronizationContext" /> object representing the current synchronization context.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B0B RID: 2827
// (get) Token: 0x06003927 RID: 14631 RVA: 0x000C55B0 File Offset: 0x000C37B0
public static SynchronizationContext Current
{
get
{
return SynchronizationContext.currentContext;
}
}
/// <summary>When overridden in a derived class, creates a copy of the synchronization context. </summary>
/// <returns>A new <see cref="T:System.Threading.SynchronizationContext" /> object.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x06003928 RID: 14632 RVA: 0x000C55B8 File Offset: 0x000C37B8
public virtual SynchronizationContext CreateCopy()
{
return new SynchronizationContext(this);
}
/// <summary>Determines if wait notification is required.</summary>
/// <returns>true if wait notification is required; otherwise, false. </returns>
// Token: 0x06003929 RID: 14633 RVA: 0x000C55C0 File Offset: 0x000C37C0
public bool IsWaitNotificationRequired()
{
return this.notification_required;
}
/// <summary>When overridden in a derived class, responds to the notification that an operation has completed.</summary>
// Token: 0x0600392A RID: 14634 RVA: 0x000C55C8 File Offset: 0x000C37C8
public virtual void OperationCompleted()
{
}
/// <summary>When overridden in a derived class, responds to the notification that an operation has started.</summary>
// Token: 0x0600392B RID: 14635 RVA: 0x000C55CC File Offset: 0x000C37CC
public virtual void OperationStarted()
{
}
/// <summary>When overridden in a derived class, dispatches an asynchronous message to a synchronization context.</summary>
/// <param name="d">The <see cref="T:System.Threading.SendOrPostCallback" /> delegate to call.</param>
/// <param name="state">The object passed to the delegate.</param>
/// <filterpriority>2</filterpriority>
// Token: 0x0600392C RID: 14636 RVA: 0x000C55D0 File Offset: 0x000C37D0
public virtual void Post(SendOrPostCallback d, object state)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(d.Invoke), state);
}
/// <summary>When overridden in a derived class, dispatches a synchronous message to a synchronization context.</summary>
/// <param name="d">The <see cref="T:System.Threading.SendOrPostCallback" /> delegate to call.</param>
/// <param name="state">The object passed to the delegate.</param>
/// <filterpriority>2</filterpriority>
// Token: 0x0600392D RID: 14637 RVA: 0x000C55E8 File Offset: 0x000C37E8
public virtual void Send(SendOrPostCallback d, object state)
{
d(state);
}
/// <summary>Sets the current synchronization context.</summary>
/// <param name="syncContext">The <see cref="T:System.Threading.SynchronizationContext" /> object to be set.</param>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
/// </PermissionSet>
// 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;
}
/// <summary>Sets notification that wait notification is required and prepares the callback method so it can be called more reliably when a wait occurs.</summary>
// Token: 0x06003930 RID: 14640 RVA: 0x000C5604 File Offset: 0x000C3804
[MonoTODO]
protected void SetWaitNotificationRequired()
{
this.notification_required = true;
throw new NotImplementedException();
}
/// <summary>Waits for any or all the elements in the specified array to receive a signal.</summary>
/// <returns>The array index of the object that satisfied the wait.</returns>
/// <param name="waitHandles">An array of type <see cref="T:System.IntPtr" /> that contains the native operating system handles.</param>
/// <param name="waitAll">true to wait for all handles; false to wait for any handle. </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely.</param>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
/// </PermissionSet>
// 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);
}
/// <summary>Helper function that waits for any or all the elements in the specified array to receive a signal.</summary>
/// <returns>The array index of the object that satisfied the wait.</returns>
/// <param name="waitHandles">An array of type <see cref="T:System.IntPtr" /> that contains the native operating system handles.</param>
/// <param name="waitAll">true to wait for all handles; false to wait for any handle. </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely.</param>
// 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;
}
}