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,115 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading
{
/// <summary>The exception that is thrown when one thread acquires a <see cref="T:System.Threading.Mutex" /> object that another thread has abandoned by exiting without releasing it.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000606 RID: 1542
[ComVisible(false)]
[Serializable]
public class AbandonedMutexException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AbandonedMutexException" /> class with default values.</summary>
// Token: 0x0600387D RID: 14461 RVA: 0x000C3B90 File Offset: 0x000C1D90
public AbandonedMutexException()
: base("Mutex was abandoned")
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AbandonedMutexException" /> class with a specified error message.</summary>
/// <param name="message">An error message that explains the reason for the exception.</param>
// Token: 0x0600387E RID: 14462 RVA: 0x000C3BA4 File Offset: 0x000C1DA4
public AbandonedMutexException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AbandonedMutexException" /> class with a specified index for the abandoned mutex, if applicable, and a <see cref="T:System.Threading.Mutex" /> object that represents the mutex.</summary>
/// <param name="location">The index of the abandoned mutex in the array of wait handles if the exception is thrown for the <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> method, or 1 if the exception is thrown for the <see cref="Overload:System.Threading.WaitHandle.WaitOne" /> or <see cref="Overload:System.Threading.WaitHandle.WaitAll" /> methods.</param>
/// <param name="handle">A <see cref="T:System.Threading.Mutex" /> object that represents the abandoned mutex.</param>
// Token: 0x0600387F RID: 14463 RVA: 0x000C3BB4 File Offset: 0x000C1DB4
public AbandonedMutexException(int location, WaitHandle handle)
: base("Mutex was abandoned")
{
this.mutex_index = location;
this.mutex = handle as Mutex;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AbandonedMutexException" /> class with serialized data.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains contextual information about the source or destination.</param>
// Token: 0x06003880 RID: 14464 RVA: 0x000C3BDC File Offset: 0x000C1DDC
protected AbandonedMutexException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AbandonedMutexException" /> class with a specified error message and inner exception. </summary>
/// <param name="message">An error message that explains the reason for the exception.</param>
/// <param name="inner">The exception that is the cause of the current exception. If the <paramref name="inner" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception.</param>
// Token: 0x06003881 RID: 14465 RVA: 0x000C3BF0 File Offset: 0x000C1DF0
public AbandonedMutexException(string message, Exception inner)
: base(message, inner)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AbandonedMutexException" /> class with a specified error message, the index of the abandoned mutex, if applicable, and the abandoned mutex. </summary>
/// <param name="message">An error message that explains the reason for the exception.</param>
/// <param name="location">The index of the abandoned mutex in the array of wait handles if the exception is thrown for the <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> method, or 1 if the exception is thrown for the <see cref="Overload:System.Threading.WaitHandle.WaitOne" /> or <see cref="Overload:System.Threading.WaitHandle.WaitAll" /> methods.</param>
/// <param name="handle">A <see cref="T:System.Threading.Mutex" /> object that represents the abandoned mutex.</param>
// Token: 0x06003882 RID: 14466 RVA: 0x000C3C04 File Offset: 0x000C1E04
public AbandonedMutexException(string message, int location, WaitHandle handle)
: base(message)
{
this.mutex_index = location;
this.mutex = handle as Mutex;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AbandonedMutexException" /> class with a specified error message, the inner exception, the index for the abandoned mutex, if applicable, and a <see cref="T:System.Threading.Mutex" /> object that represents the mutex.</summary>
/// <param name="message">An error message that explains the reason for the exception.</param>
/// <param name="inner">The exception that is the cause of the current exception. If the <paramref name="inner" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception.</param>
/// <param name="location">The index of the abandoned mutex in the array of wait handles if the exception is thrown for the <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> method, or 1 if the exception is thrown for the <see cref="Overload:System.Threading.WaitHandle.WaitOne" /> or <see cref="Overload:System.Threading.WaitHandle.WaitAll" /> methods.</param>
/// <param name="handle">A <see cref="T:System.Threading.Mutex" /> object that represents the abandoned mutex.</param>
// Token: 0x06003883 RID: 14467 RVA: 0x000C3C28 File Offset: 0x000C1E28
public AbandonedMutexException(string message, Exception inner, int location, WaitHandle handle)
: base(message, inner)
{
this.mutex_index = location;
this.mutex = handle as Mutex;
}
/// <summary>Gets the abandoned mutex that caused the exception, if known.</summary>
/// <returns>A <see cref="T:System.Threading.Mutex" /> object that represents the abandoned mutex, or null if the abandoned mutex could not be identified.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000AFC RID: 2812
// (get) Token: 0x06003884 RID: 14468 RVA: 0x000C3C50 File Offset: 0x000C1E50
public Mutex Mutex
{
get
{
return this.mutex;
}
}
/// <summary>Gets the index of the abandoned mutex that caused the exception, if known.</summary>
/// <returns>The index, in the array of wait handles passed to the <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> method, of the <see cref="T:System.Threading.Mutex" /> object that represents the abandoned mutex, or 1 if the index of the abandoned mutex could not be determined.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000AFD RID: 2813
// (get) Token: 0x06003885 RID: 14469 RVA: 0x000C3C58 File Offset: 0x000C1E58
public int MutexIndex
{
get
{
return this.mutex_index;
}
}
// Token: 0x040016D8 RID: 5848
private Mutex mutex;
// Token: 0x040016D9 RID: 5849
private int mutex_index = -1;
}
}
@@ -0,0 +1,23 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Specifies the apartment state of a <see cref="T:System.Threading.Thread" />.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000607 RID: 1543
[ComVisible(true)]
[Serializable]
public enum ApartmentState
{
/// <summary>The <see cref="T:System.Threading.Thread" /> will create and enter a single-threaded apartment.</summary>
// Token: 0x040016DB RID: 5851
STA,
/// <summary>The <see cref="T:System.Threading.Thread" /> will create and enter a multithreaded apartment.</summary>
// Token: 0x040016DC RID: 5852
MTA,
/// <summary>The <see cref="P:System.Threading.Thread.ApartmentState" /> property has not been set.</summary>
// Token: 0x040016DD RID: 5853
Unknown
}
}
@@ -0,0 +1,107 @@
using System;
using System.Security;
namespace System.Threading
{
/// <summary>Provides the functionality to restore the migration, or flow, of the execution context between threads. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000609 RID: 1545
public struct AsyncFlowControl : IDisposable
{
// Token: 0x06003886 RID: 14470 RVA: 0x000C3C60 File Offset: 0x000C1E60
internal AsyncFlowControl(Thread t, AsyncFlowControlType type)
{
this._t = t;
this._type = type;
}
/// <summary>Releases all resources used by the <see cref="T:System.Threading.AsyncFlowControl" />.</summary>
// Token: 0x06003887 RID: 14471 RVA: 0x000C3C70 File Offset: 0x000C1E70
void IDisposable.Dispose()
{
if (this._t != null)
{
this.Undo();
this._t = null;
this._type = AsyncFlowControlType.None;
}
}
/// <summary>Restores the flow of the execution context between threads.</summary>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Threading.AsyncFlowControl" /> structure is not used on the thread where it was created.-or-The <see cref="T:System.Threading.AsyncFlowControl" /> structure has already been used to call <see cref="M:System.Threading.AsyncFlowControl.Undo" />.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003888 RID: 14472 RVA: 0x000C3C94 File Offset: 0x000C1E94
public void Undo()
{
if (this._t == null)
{
throw new InvalidOperationException(Locale.GetText("Can only be called once."));
}
AsyncFlowControlType type = this._type;
if (type != AsyncFlowControlType.Execution)
{
if (type == AsyncFlowControlType.Security)
{
SecurityContext.RestoreFlow();
}
}
else
{
ExecutionContext.RestoreFlow();
}
this._t = null;
}
/// <summary>Gets a hash code for the current <see cref="T:System.Threading.AsyncFlowControl" /> structure.</summary>
/// <returns>A hash code for the current <see cref="T:System.Threading.AsyncFlowControl" /> structure.</returns>
// Token: 0x06003889 RID: 14473 RVA: 0x000C3CF4 File Offset: 0x000C1EF4
public override int GetHashCode()
{
return base.GetHashCode();
}
/// <summary>Determines whether the specified object is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure. </summary>
/// <returns>true if <paramref name="obj" /> is an <see cref="T:System.Threading.AsyncFlowControl" /> structure and is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure; otherwise, false. </returns>
/// <param name="obj">An object to compare with the current structure.</param>
// Token: 0x0600388A RID: 14474 RVA: 0x000C3D08 File Offset: 0x000C1F08
public override bool Equals(object obj)
{
return obj is AsyncFlowControl && obj.Equals(this);
}
/// <summary>Determines whether the specified <see cref="T:System.Threading.AsyncFlowControl" /> structure is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure.</summary>
/// <returns>true if <paramref name="obj" /> is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure; otherwise, false. </returns>
/// <param name="obj">An <see cref="T:System.Threading.AsyncFlowControl" /> structure to compare with the current structure.</param>
// Token: 0x0600388B RID: 14475 RVA: 0x000C3D28 File Offset: 0x000C1F28
public bool Equals(AsyncFlowControl obj)
{
return this._t == obj._t && this._type == obj._type;
}
/// <summary>Compares two <see cref="T:System.Threading.AsyncFlowControl" /> structures to determine whether they are equal. </summary>
/// <returns>true if the two structures are equal; otherwise, false. </returns>
/// <param name="a">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
/// <param name="b">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
// Token: 0x0600388C RID: 14476 RVA: 0x000C3D54 File Offset: 0x000C1F54
public static bool operator ==(AsyncFlowControl a, AsyncFlowControl b)
{
return a.Equals(b);
}
/// <summary>Compares two <see cref="T:System.Threading.AsyncFlowControl" /> structures to determine whether they are not equal. </summary>
/// <returns>true if the structures are not equal; otherwise, false. </returns>
/// <param name="a">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
/// <param name="b">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
// Token: 0x0600388D RID: 14477 RVA: 0x000C3D60 File Offset: 0x000C1F60
public static bool operator !=(AsyncFlowControl a, AsyncFlowControl b)
{
return !a.Equals(b);
}
// Token: 0x040016E2 RID: 5858
private Thread _t;
// Token: 0x040016E3 RID: 5859
private AsyncFlowControlType _type;
}
}
@@ -0,0 +1,15 @@
using System;
namespace System.Threading
{
// Token: 0x02000608 RID: 1544
internal enum AsyncFlowControlType
{
// Token: 0x040016DF RID: 5855
None,
// Token: 0x040016E0 RID: 5856
Execution,
// Token: 0x040016E1 RID: 5857
Security
}
}
@@ -0,0 +1,20 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Notifies a waiting thread that an event has occurred. This class cannot be inherited.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200060A RID: 1546
[ComVisible(true)]
public sealed class AutoResetEvent : EventWaitHandle
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.AutoResetEvent" /> class with a Boolean value indicating whether to set the initial state to signaled.</summary>
/// <param name="initialState">true to set the initial state to signaled; false to set the initial state to non-signaled. </param>
// Token: 0x0600388E RID: 14478 RVA: 0x000C3D70 File Offset: 0x000C1F70
public AutoResetEvent(bool initialState)
: base(initialState, EventResetMode.AutoReset)
{
}
}
}
@@ -0,0 +1,181 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
namespace System.Threading
{
/// <summary>Provides methods for setting and capturing the compressed stack on the current thread. This class cannot be inherited. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200060B RID: 1547
[Serializable]
public sealed class CompressedStack : ISerializable
{
// Token: 0x0600388F RID: 14479 RVA: 0x000C3D7C File Offset: 0x000C1F7C
internal CompressedStack(int length)
{
if (length > 0)
{
this._list = new ArrayList(length);
}
}
// Token: 0x06003890 RID: 14480 RVA: 0x000C3D98 File Offset: 0x000C1F98
internal CompressedStack(CompressedStack cs)
{
if (cs != null && cs._list != null)
{
this._list = (ArrayList)cs._list.Clone();
}
}
/// <summary>Creates a copy of the current compressed stack.</summary>
/// <returns>A <see cref="T:System.Threading.CompressedStack" /> object representing the current compressed stack.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x06003891 RID: 14481 RVA: 0x000C3DC8 File Offset: 0x000C1FC8
[ComVisible(false)]
public CompressedStack CreateCopy()
{
return new CompressedStack(this);
}
/// <summary>Captures the compressed stack from the current thread.</summary>
/// <returns>A <see cref="T:System.Threading.CompressedStack" /> object.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x06003892 RID: 14482 RVA: 0x000C3DD0 File Offset: 0x000C1FD0
public static CompressedStack Capture()
{
CompressedStack compressedStack = new CompressedStack(0);
compressedStack._list = SecurityFrame.GetStack(1);
CompressedStack compressedStack2 = Thread.CurrentThread.GetCompressedStack();
if (compressedStack2 != null)
{
for (int i = 0; i < compressedStack2._list.Count; i++)
{
compressedStack._list.Add(compressedStack2._list[i]);
}
}
return compressedStack;
}
/// <summary>Gets the compressed stack for the current thread.</summary>
/// <returns>A <see cref="T:System.Threading.CompressedStack" /> for the current thread.</returns>
/// <exception cref="T:System.Security.SecurityException">A caller in the call chain does not have permission to access unmanaged code.-or-The request for <see cref="T:System.Security.Permissions.StrongNameIdentityPermission" /> failed.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="00000000000000000400000000000000" />
/// </PermissionSet>
// Token: 0x06003893 RID: 14483 RVA: 0x000C3E38 File Offset: 0x000C2038
public static CompressedStack GetCompressedStack()
{
CompressedStack compressedStack = Thread.CurrentThread.GetCompressedStack();
if (compressedStack == null)
{
compressedStack = CompressedStack.Capture();
}
else
{
CompressedStack compressedStack2 = CompressedStack.Capture();
for (int i = 0; i < compressedStack2._list.Count; i++)
{
compressedStack._list.Add(compressedStack2._list[i]);
}
}
return compressedStack;
}
/// <summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the logical context information needed to recreate an instance of this execution context.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object to be populated with serialization information. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> structure representing the destination context of the serialization. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="info" /> is null. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x06003894 RID: 14484 RVA: 0x000C3E9C File Offset: 0x000C209C
[MonoTODO("incomplete")]
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
}
/// <summary>Runs a method in the specified compressed stack on the current thread.</summary>
/// <param name="compressedStack">The <see cref="T:System.Threading.CompressedStack" /> to set.</param>
/// <param name="callback">A <see cref="T:System.Threading.ContextCallback" /> that represents the method to be run in the specified security context.</param>
/// <param name="state">The object to be passed to the callback method.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="compressedStack" /> is null.</exception>
// Token: 0x06003895 RID: 14485 RVA: 0x000C3EB0 File Offset: 0x000C20B0
public static void Run(CompressedStack compressedStack, ContextCallback callback, object state)
{
if (compressedStack == null)
{
throw new ArgumentException("compressedStack");
}
Thread currentThread = Thread.CurrentThread;
CompressedStack compressedStack2 = null;
try
{
compressedStack2 = currentThread.GetCompressedStack();
currentThread.SetCompressedStack(compressedStack);
callback(state);
}
finally
{
if (compressedStack2 != null)
{
currentThread.SetCompressedStack(compressedStack2);
}
}
}
// Token: 0x06003896 RID: 14486 RVA: 0x000C3F1C File Offset: 0x000C211C
internal bool Equals(CompressedStack cs)
{
if (this.IsEmpty())
{
return cs.IsEmpty();
}
if (cs.IsEmpty())
{
return false;
}
if (this._list.Count != cs._list.Count)
{
return false;
}
for (int i = 0; i < this._list.Count; i++)
{
SecurityFrame securityFrame = (SecurityFrame)this._list[i];
SecurityFrame securityFrame2 = (SecurityFrame)cs._list[i];
if (!securityFrame.Equals(securityFrame2))
{
return false;
}
}
return true;
}
// Token: 0x06003897 RID: 14487 RVA: 0x000C3FB8 File Offset: 0x000C21B8
internal bool IsEmpty()
{
return this._list == null || this._list.Count == 0;
}
// Token: 0x17000AFE RID: 2814
// (get) Token: 0x06003898 RID: 14488 RVA: 0x000C3FD8 File Offset: 0x000C21D8
internal IList List
{
get
{
return this._list;
}
}
// Token: 0x040016E4 RID: 5860
private ArrayList _list;
}
}
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents a method to be called within a new context. </summary>
/// <param name="state">An object containing information to be used by the callback method each time it executes.</param>
/// <filterpriority>1</filterpriority>
// Token: 0x020006DC RID: 1756
// (Invoke) Token: 0x060041F8 RID: 16888
[ComVisible(true)]
public delegate void ContextCallback(object state);
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Indicates whether an <see cref="T:System.Threading.EventWaitHandle" /> is reset automatically or manually after receiving a signal.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200060C RID: 1548
[ComVisible(false)]
public enum EventResetMode
{
/// <summary>When signaled, the <see cref="T:System.Threading.EventWaitHandle" /> resets automatically after releasing a single thread. If no threads are waiting, the <see cref="T:System.Threading.EventWaitHandle" /> remains signaled until a thread blocks, and resets after releasing the thread.</summary>
// Token: 0x040016E6 RID: 5862
AutoReset,
/// <summary>When signaled, the <see cref="T:System.Threading.EventWaitHandle" /> releases all waiting threads and remains signaled until it is manually reset.</summary>
// Token: 0x040016E7 RID: 5863
ManualReset
}
}
@@ -0,0 +1,95 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents a thread synchronization event.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200060D RID: 1549
[ComVisible(true)]
public class EventWaitHandle : WaitHandle
{
// Token: 0x06003899 RID: 14489 RVA: 0x000C3FE0 File Offset: 0x000C21E0
private EventWaitHandle(IntPtr handle)
{
this.Handle = handle;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.EventWaitHandle" /> class, specifying whether the wait handle is initially signaled, and whether it resets automatically or manually.</summary>
/// <param name="initialState">true to set the initial state to signaled; false to set it to nonsignaled.</param>
/// <param name="mode">One of the <see cref="T:System.Threading.EventResetMode" /> values that determines whether the event resets automatically or manually.</param>
// Token: 0x0600389A RID: 14490 RVA: 0x000C3FF0 File Offset: 0x000C21F0
public EventWaitHandle(bool initialState, EventResetMode mode)
{
bool flag = this.IsManualReset(mode);
bool flag2;
this.Handle = NativeEventCalls.CreateEvent_internal(flag, initialState, null, out flag2);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.EventWaitHandle" /> class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, and the name of a system synchronization event.</summary>
/// <param name="initialState">true to set the initial state to signaled if the named event is created as a result of this call; false to set it to nonsignaled.</param>
/// <param name="mode">One of the <see cref="T:System.Threading.EventResetMode" /> values that determines whether the event resets automatically or manually.</param>
/// <param name="name">The name of a system-wide synchronization event.</param>
/// <exception cref="T:System.IO.IOException">A Win32 error occurred.</exception>
/// <exception cref="T:System.UnauthorizedAccessException">The named event exists and has access control security, but the user does not have <see cref="F:System.Security.AccessControl.EventWaitHandleRights.FullControl" />.</exception>
/// <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException">The named event cannot be created, perhaps because a wait handle of a different type has the same name.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> is longer than 260 characters.</exception>
// Token: 0x0600389B RID: 14491 RVA: 0x000C401C File Offset: 0x000C221C
public EventWaitHandle(bool initialState, EventResetMode mode, string name)
{
bool flag = this.IsManualReset(mode);
bool flag2;
this.Handle = NativeEventCalls.CreateEvent_internal(flag, initialState, name, out flag2);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.EventWaitHandle" /> class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, the name of a system synchronization event, and a Boolean variable whose value after the call indicates whether the named system event was created.</summary>
/// <param name="initialState">true to set the initial state to signaled if the named event is created as a result of this call; false to set it to nonsignaled.</param>
/// <param name="mode">One of the <see cref="T:System.Threading.EventResetMode" /> values that determines whether the event resets automatically or manually.</param>
/// <param name="name">The name of a system-wide synchronization event.</param>
/// <param name="createdNew">When this method returns, contains true if a local event was created (that is, if <paramref name="name" /> is null or an empty string) or if the specified named system event was created; false if the specified named system event already existed. This parameter is passed uninitialized.</param>
/// <exception cref="T:System.IO.IOException">A Win32 error occurred.</exception>
/// <exception cref="T:System.UnauthorizedAccessException">The named event exists and has access control security, but the user does not have <see cref="F:System.Security.AccessControl.EventWaitHandleRights.FullControl" />.</exception>
/// <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException">The named event cannot be created, perhaps because a wait handle of a different type has the same name.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> is longer than 260 characters.</exception>
// Token: 0x0600389C RID: 14492 RVA: 0x000C4048 File Offset: 0x000C2248
public EventWaitHandle(bool initialState, EventResetMode mode, string name, out bool createdNew)
{
bool flag = this.IsManualReset(mode);
this.Handle = NativeEventCalls.CreateEvent_internal(flag, initialState, name, out createdNew);
}
// Token: 0x0600389D RID: 14493 RVA: 0x000C4074 File Offset: 0x000C2274
private bool IsManualReset(EventResetMode mode)
{
if (mode < EventResetMode.AutoReset || mode > EventResetMode.ManualReset)
{
throw new ArgumentException("mode");
}
return mode == EventResetMode.ManualReset;
}
/// <summary>Sets the state of the event to nonsignaled, causing threads to block.</summary>
/// <returns>true if the operation succeeds; otherwise, false.</returns>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="M:System.Threading.EventWaitHandle.Close" /> method was previously called on this <see cref="T:System.Threading.EventWaitHandle" />.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x0600389E RID: 14494 RVA: 0x000C4094 File Offset: 0x000C2294
public bool Reset()
{
base.CheckDisposed();
return NativeEventCalls.ResetEvent_internal(this.Handle);
}
/// <summary>Sets the state of the event to signaled, allowing one or more waiting threads to proceed.</summary>
/// <returns>true if the operation succeeds; otherwise, false.</returns>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="M:System.Threading.EventWaitHandle.Close" /> method was previously called on this <see cref="T:System.Threading.EventWaitHandle" />.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x0600389F RID: 14495 RVA: 0x000C40A8 File Offset: 0x000C22A8
public bool Set()
{
base.CheckDisposed();
return NativeEventCalls.SetEvent_internal(this.Handle);
}
}
}
@@ -0,0 +1,188 @@
using System;
using System.Runtime.Serialization;
using System.Security;
namespace System.Threading
{
/// <summary>Manages the execution context for the current thread. This class cannot be inherited.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200060E RID: 1550
[Serializable]
public sealed class ExecutionContext : ISerializable
{
// Token: 0x060038A0 RID: 14496 RVA: 0x000C40BC File Offset: 0x000C22BC
internal ExecutionContext()
{
}
// Token: 0x060038A1 RID: 14497 RVA: 0x000C40C4 File Offset: 0x000C22C4
internal ExecutionContext(ExecutionContext ec)
{
if (ec._sc != null)
{
this._sc = new SecurityContext(ec._sc);
}
this._suppressFlow = ec._suppressFlow;
this._capture = true;
}
// Token: 0x060038A2 RID: 14498 RVA: 0x000C40FC File Offset: 0x000C22FC
[MonoTODO]
internal ExecutionContext(SerializationInfo info, StreamingContext context)
{
throw new NotImplementedException();
}
/// <summary>Captures the execution context from the current thread.</summary>
/// <returns>An <see cref="T:System.Threading.ExecutionContext" /> object representing the execution context for the current thread.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x060038A3 RID: 14499 RVA: 0x000C410C File Offset: 0x000C230C
public static ExecutionContext Capture()
{
ExecutionContext executionContext = Thread.CurrentThread.ExecutionContext;
if (executionContext.FlowSuppressed)
{
return null;
}
ExecutionContext executionContext2 = new ExecutionContext(executionContext);
if (SecurityManager.SecurityEnabled)
{
executionContext2.SecurityContext = SecurityContext.Capture();
}
return executionContext2;
}
/// <summary>Creates a copy of the current execution context.</summary>
/// <returns>An <see cref="T:System.Threading.ExecutionContext" /> object representing the current execution context.</returns>
/// <exception cref="T:System.InvalidOperationException">This context cannot be copied because it is used. Only newly captured contexts can be copied.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060038A4 RID: 14500 RVA: 0x000C4150 File Offset: 0x000C2350
public ExecutionContext CreateCopy()
{
if (!this._capture)
{
throw new InvalidOperationException();
}
return new ExecutionContext(this);
}
/// <summary>Sets the specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the logical context information needed to recreate an instance of the current execution context.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object to be populated with serialization information. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> structure representing the destination context of the serialization. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="info" /> is null. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060038A5 RID: 14501 RVA: 0x000C416C File Offset: 0x000C236C
[MonoTODO]
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
throw new NotImplementedException();
}
// Token: 0x17000AFF RID: 2815
// (get) Token: 0x060038A6 RID: 14502 RVA: 0x000C4184 File Offset: 0x000C2384
// (set) Token: 0x060038A7 RID: 14503 RVA: 0x000C41A4 File Offset: 0x000C23A4
internal SecurityContext SecurityContext
{
get
{
if (this._sc == null)
{
this._sc = new SecurityContext();
}
return this._sc;
}
set
{
this._sc = value;
}
}
// Token: 0x17000B00 RID: 2816
// (get) Token: 0x060038A8 RID: 14504 RVA: 0x000C41B0 File Offset: 0x000C23B0
// (set) Token: 0x060038A9 RID: 14505 RVA: 0x000C41B8 File Offset: 0x000C23B8
internal bool FlowSuppressed
{
get
{
return this._suppressFlow;
}
set
{
this._suppressFlow = value;
}
}
/// <summary>Indicates whether the flow of the execution context is currently suppressed.</summary>
/// <returns>true if the flow is suppressed; otherwise, false. </returns>
/// <filterpriority>1</filterpriority>
// Token: 0x060038AA RID: 14506 RVA: 0x000C41C4 File Offset: 0x000C23C4
public static bool IsFlowSuppressed()
{
return Thread.CurrentThread.ExecutionContext.FlowSuppressed;
}
/// <summary>Restores the flow of the execution context across asynchronous threads.</summary>
/// <exception cref="T:System.InvalidOperationException">The context flow cannot be restored because it is not being suppressed.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038AB RID: 14507 RVA: 0x000C41D8 File Offset: 0x000C23D8
public static void RestoreFlow()
{
ExecutionContext executionContext = Thread.CurrentThread.ExecutionContext;
if (!executionContext.FlowSuppressed)
{
throw new InvalidOperationException();
}
executionContext.FlowSuppressed = false;
}
/// <summary>Runs a method in a specified execution context on the current thread.</summary>
/// <param name="executionContext">The <see cref="T:System.Threading.ExecutionContext" /> to set.</param>
/// <param name="callback">A <see cref="T:System.Threading.ContextCallback" /> delegate that represents the method to be run in the provided execution context.</param>
/// <param name="state">The object to pass to the callback method.</param>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="executionContext" /> is null.-or-<paramref name="executionContext" /> was not acquired through a capture operation. -or-<paramref name="executionContext" /> has already been used as the argument to a <see cref="M:System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)" /> call.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060038AC RID: 14508 RVA: 0x000C4208 File Offset: 0x000C2408
[MonoTODO("only the SecurityContext is considered")]
public static void Run(ExecutionContext executionContext, ContextCallback callback, object state)
{
if (executionContext == null)
{
throw new InvalidOperationException(Locale.GetText("Null ExecutionContext"));
}
SecurityContext.Run(executionContext.SecurityContext, callback, state);
}
/// <summary>Suppresses the flow of the execution context across asynchronous threads.</summary>
/// <returns>An <see cref="T:System.Threading.AsyncFlowControl" /> structure for restoring the flow.</returns>
/// <exception cref="T:System.InvalidOperationException">The context flow is already suppressed.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060038AD RID: 14509 RVA: 0x000C4230 File Offset: 0x000C2430
public static AsyncFlowControl SuppressFlow()
{
Thread currentThread = Thread.CurrentThread;
currentThread.ExecutionContext.FlowSuppressed = true;
return new AsyncFlowControl(currentThread, AsyncFlowControlType.Execution);
}
// Token: 0x040016E8 RID: 5864
private SecurityContext _sc;
// Token: 0x040016E9 RID: 5865
private bool _suppressFlow;
// Token: 0x040016EA RID: 5866
private bool _capture;
}
}
@@ -0,0 +1,55 @@
using System;
namespace System.Threading
{
/// <summary>Encapsulates and propagates the host execution context across threads. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200060F RID: 1551
[MonoTODO("Useless until the runtime supports it")]
public class HostExecutionContext
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.HostExecutionContext" /> class. </summary>
// Token: 0x060038AE RID: 14510 RVA: 0x000C4258 File Offset: 0x000C2458
public HostExecutionContext()
{
this._state = null;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.HostExecutionContext" /> class using the specified state. </summary>
/// <param name="state">An object representing the host execution context state.</param>
// Token: 0x060038AF RID: 14511 RVA: 0x000C4268 File Offset: 0x000C2468
public HostExecutionContext(object state)
{
this._state = state;
}
/// <summary>Creates a copy of the current host execution context.</summary>
/// <returns>A <see cref="T:System.Threading.HostExecutionContext" /> object representing the host context for the current thread.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x060038B0 RID: 14512 RVA: 0x000C4278 File Offset: 0x000C2478
public virtual HostExecutionContext CreateCopy()
{
return new HostExecutionContext(this._state);
}
/// <summary>Gets or sets the state of the host execution context.</summary>
/// <returns>An object representing the host execution context state.</returns>
// Token: 0x17000B01 RID: 2817
// (get) Token: 0x060038B1 RID: 14513 RVA: 0x000C4288 File Offset: 0x000C2488
// (set) Token: 0x060038B2 RID: 14514 RVA: 0x000C4290 File Offset: 0x000C2490
protected internal object State
{
get
{
return this._state;
}
set
{
this._state = value;
}
}
// Token: 0x040016EB RID: 5867
private object _state;
}
}
@@ -0,0 +1,49 @@
using System;
using System.Runtime.ConstrainedExecution;
namespace System.Threading
{
/// <summary>Provides the functionality that allows a common language runtime host to participate in the flow, or migration, of the execution context.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000610 RID: 1552
public class HostExecutionContextManager
{
/// <summary>Captures the host execution context from the current thread.</summary>
/// <returns>A <see cref="T:System.Threading.HostExecutionContext" /> object representing the host execution context of the current thread.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x060038B4 RID: 14516 RVA: 0x000C42A4 File Offset: 0x000C24A4
[MonoTODO]
public virtual HostExecutionContext Capture()
{
throw new NotImplementedException();
}
/// <summary>Restores the host execution context to its prior state.</summary>
/// <param name="previousState">The previous context state to revert to.</param>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="previousState" /> is null.-or-<paramref name="previousState" /> was not created on the current thread.-or-<paramref name="previousState" /> is not the last state for the <see cref="T:System.Threading.HostExecutionContext" />.</exception>
// Token: 0x060038B5 RID: 14517 RVA: 0x000C42AC File Offset: 0x000C24AC
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[MonoTODO]
public virtual void Revert(object previousState)
{
throw new NotImplementedException();
}
/// <summary>Sets the current host execution context to the specified host execution context.</summary>
/// <returns>An object for restoring the <see cref="T:System.Threading.HostExecutionContext" /> to its previous state.</returns>
/// <param name="hostExecutionContext">The <see cref="T:System.Threading.HostExecutionContext" /> to be set.</param>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="hostExecutionContext" /> was not acquired through a capture operation. -or- <paramref name="hostExecutionContext" /> has been the argument to a previous <see cref="M:System.Threading.HostExecutionContextManager.SetHostExecutionContext(System.Threading.HostExecutionContext)" /> method call.</exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060038B6 RID: 14518 RVA: 0x000C42B4 File Offset: 0x000C24B4
[MonoTODO]
public virtual object SetHostExecutionContext(HostExecutionContext hostExecutionContext)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,16 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Receives the error code, number of bytes, and overlapped value type when an I/O operation completes on the thread pool.</summary>
/// <param name="errorCode">The error code. </param>
/// <param name="numBytes">The number of bytes that are transferred. </param>
/// <param name="pOVERLAP">A <see cref="T:System.Threading.NativeOverlapped" /> representing an unmanaged pointer to the native overlapped value type. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x020006DD RID: 1757
// (Invoke) Token: 0x060041FC RID: 16892
[CLSCompliant(false)]
[ComVisible(true)]
public unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped* pOVERLAP);
}
+238
View File
@@ -0,0 +1,238 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Provides atomic operations for variables that are shared by multiple threads. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000611 RID: 1553
public static class Interlocked
{
/// <summary>Compares two 32-bit signed integers for equality and, if they are equal, replaces one of the values.</summary>
/// <returns>The original value in <paramref name="location1" />.</returns>
/// <param name="location1">The destination, whose value is compared with <paramref name="comparand" /> and possibly replaced. </param>
/// <param name="value">The value that replaces the destination value if the comparison results in equality. </param>
/// <param name="comparand">The value that is compared to the value at <paramref name="location1" />. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038B7 RID: 14519
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int CompareExchange(ref int location1, int value, int comparand);
/// <summary>Compares two objects for reference equality and, if they are equal, replaces one of the objects.</summary>
/// <returns>The original value in <paramref name="location1" />.</returns>
/// <param name="location1">The destination object that is compared with <paramref name="comparand" /> and possibly replaced. </param>
/// <param name="value">The object that replaces the destination object if the comparison results in equality. </param>
/// <param name="comparand">The object that is compared to the object at <paramref name="location1" />. </param>
/// <exception cref="T:System.ArgumentNullException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038B8 RID: 14520
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern object CompareExchange(ref object location1, object value, object comparand);
/// <summary>Compares two single-precision floating point numbers for equality and, if they are equal, replaces one of the values.</summary>
/// <returns>The original value in <paramref name="location1" />.</returns>
/// <param name="location1">The destination, whose value is compared with <paramref name="comparand" /> and possibly replaced. </param>
/// <param name="value">The value that replaces the destination value if the comparison results in equality. </param>
/// <param name="comparand">The value that is compared to the value at <paramref name="location1" />. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038B9 RID: 14521
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float CompareExchange(ref float location1, float value, float comparand);
/// <summary>Decrements a specified variable and stores the result, as an atomic operation.</summary>
/// <returns>The decremented value.</returns>
/// <param name="location">The variable whose value is to be decremented. </param>
/// <exception cref="T:System.ArgumentNullException">The address of <paramref name="location" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038BA RID: 14522
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int Decrement(ref int location);
/// <summary>Decrements the specified variable and stores the result, as an atomic operation.</summary>
/// <returns>The decremented value.</returns>
/// <param name="location">The variable whose value is to be decremented. </param>
/// <exception cref="T:System.ArgumentNullException">The address of <paramref name="location" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038BB RID: 14523
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern long Decrement(ref long location);
/// <summary>Increments a specified variable and stores the result, as an atomic operation.</summary>
/// <returns>The incremented value.</returns>
/// <param name="location">The variable whose value is to be incremented. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038BC RID: 14524
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int Increment(ref int location);
/// <summary>Increments a specified variable and stores the result, as an atomic operation.</summary>
/// <returns>The incremented value.</returns>
/// <param name="location">The variable whose value is to be incremented. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038BD RID: 14525
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern long Increment(ref long location);
/// <summary>Sets a 32-bit signed integer to a specified value and returns the original value, as an atomic operation.</summary>
/// <returns>The original value of <paramref name="location1" />.</returns>
/// <param name="location1">The variable to set to the specified value. </param>
/// <param name="value">The value to which the <paramref name="location1" /> parameter is set. </param>
/// <exception cref="T:System.ArgumentNullException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038BE RID: 14526
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int Exchange(ref int location1, int value);
/// <summary>Sets an object to a specified value and returns a reference to the original object, as an atomic operation.</summary>
/// <returns>The original value of <paramref name="location1" />.</returns>
/// <param name="location1">The variable to set to the specified value. </param>
/// <param name="value">The value to which the <paramref name="location1" /> parameter is set. </param>
/// <exception cref="T:System.ArgumentNullException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038BF RID: 14527
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern object Exchange(ref object location1, object value);
/// <summary>Sets a single-precision floating point number to a specified value and returns the original value, as an atomic operation.</summary>
/// <returns>The original value of <paramref name="location1" />.</returns>
/// <param name="location1">The variable to set to the specified value. </param>
/// <param name="value">The value to which the <paramref name="location1" /> parameter is set. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C0 RID: 14528
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Exchange(ref float location1, float value);
/// <summary>Compares two 64-bit signed integers for equality and, if they are equal, replaces one of the values.</summary>
/// <returns>The original value in <paramref name="location1" />.</returns>
/// <param name="location1">The destination, whose value is compared with <paramref name="comparand" /> and possibly replaced. </param>
/// <param name="value">The value that replaces the destination value if the comparison results in equality. </param>
/// <param name="comparand">The value that is compared to the value at <paramref name="location1" />. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C1 RID: 14529
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern long CompareExchange(ref long location1, long value, long comparand);
/// <summary>Compares two platform-specific handles or pointers for equality and, if they are equal, replaces one of them.</summary>
/// <returns>The original value in <paramref name="location1" />.</returns>
/// <param name="location1">The destination <see cref="T:System.IntPtr" />, whose value is compared with the value of <paramref name="comparand" /> and possibly replaced by <paramref name="value" />. </param>
/// <param name="value">The <see cref="T:System.IntPtr" /> that replaces the destination value if the comparison results in equality. </param>
/// <param name="comparand">The <see cref="T:System.IntPtr" /> that is compared to the value at <paramref name="location1" />. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C2 RID: 14530
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern IntPtr CompareExchange(ref IntPtr location1, IntPtr value, IntPtr comparand);
/// <summary>Compares two double-precision floating point numbers for equality and, if they are equal, replaces one of the values.</summary>
/// <returns>The original value in <paramref name="location1" />.</returns>
/// <param name="location1">The destination, whose value is compared with <paramref name="comparand" /> and possibly replaced. </param>
/// <param name="value">The value that replaces the destination value if the comparison results in equality. </param>
/// <param name="comparand">The value that is compared to the value at <paramref name="location1" />. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C3 RID: 14531
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double CompareExchange(ref double location1, double value, double comparand);
/// <summary>Compares two instances of the specified reference type <paramref name="T" /> for equality and, if they are equal, replaces one of them.</summary>
/// <returns>The original value in <paramref name="location1" />.</returns>
/// <param name="location1">The destination, whose value is compared with <paramref name="comparand" /> and possibly replaced. This is a reference parameter (ref in C#, ByRef in Visual Basic). </param>
/// <param name="value">The value that replaces the destination value if the comparison results in equality. </param>
/// <param name="comparand">The value that is compared to the value at <paramref name="location1" />. </param>
/// <typeparam name="T">The type to be used for <paramref name="location1" />, <paramref name="value" />, and <paramref name="comparand" />. This type must be a reference type.</typeparam>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
// Token: 0x060038C4 RID: 14532
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[ComVisible(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern T CompareExchange<T>(ref T location1, T value, T comparand) where T : class;
/// <summary>Sets a 64-bit signed integer to a specified value and returns the original value, as an atomic operation.</summary>
/// <returns>The original value of <paramref name="location1" />.</returns>
/// <param name="location1">The variable to set to the specified value. </param>
/// <param name="value">The value to which the <paramref name="location1" /> parameter is set. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C5 RID: 14533
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern long Exchange(ref long location1, long value);
/// <summary>Sets a platform-specific handle or pointer to a specified value and returns the original value, as an atomic operation.</summary>
/// <returns>The original value of <paramref name="location1" />.</returns>
/// <param name="location1">The variable to set to the specified value. </param>
/// <param name="value">The value to which the <paramref name="location1" /> parameter is set. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C6 RID: 14534
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern IntPtr Exchange(ref IntPtr location1, IntPtr value);
/// <summary>Sets a double-precision floating point number to a specified value and returns the original value, as an atomic operation.</summary>
/// <returns>The original value of <paramref name="location1" />.</returns>
/// <param name="location1">The variable to set to the specified value. </param>
/// <param name="value">The value to which the <paramref name="location1" /> parameter is set. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C7 RID: 14535
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Exchange(ref double location1, double value);
/// <summary>Sets a variable of the specified type <paramref name="T" /> to a specified value and returns the original value, as an atomic operation.</summary>
/// <returns>The original value of <paramref name="location1" />.</returns>
/// <param name="location1">The variable to set to the specified value. This is a reference parameter (ref in C#, ByRef in Visual Basic). </param>
/// <param name="value">The value to which the <paramref name="location1" /> parameter is set. </param>
/// <typeparam name="T">The type to be used for <paramref name="location1" /> and <paramref name="value" />. This type must be a reference type.</typeparam>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
// Token: 0x060038C8 RID: 14536
[ComVisible(false)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern T Exchange<T>(ref T location1, T value) where T : class;
/// <summary>Returns a 64-bit value, loaded as an atomic operation.</summary>
/// <returns>The loaded value.</returns>
/// <param name="location">The 64-bit value to be loaded.</param>
/// <filterpriority>1</filterpriority>
// Token: 0x060038C9 RID: 14537
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern long Read(ref long location);
/// <summary>Adds two 32-bit integers and replaces the first integer with the sum, as an atomic operation.</summary>
/// <returns>The new value stored at <paramref name="location1" />.</returns>
/// <param name="location1">A variable containing the first value to be added. The sum of the two values is stored in <paramref name="location1" />.</param>
/// <param name="value">The value to be added to the integer at <paramref name="location1" />.</param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038CA RID: 14538
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int Add(ref int location1, int value);
/// <summary>Adds two 64-bit integers and replaces the first integer with the sum, as an atomic operation.</summary>
/// <returns>The new value stored at <paramref name="location1" />.</returns>
/// <param name="location1">A variable containing the first value to be added. The sum of the two values is stored in <paramref name="location1" />.</param>
/// <param name="value">The value to be added to the integer at <paramref name="location1" />.</param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038CB RID: 14539
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern long Add(ref long location1, long value);
}
}
+83
View File
@@ -0,0 +1,83 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Defines the lock that implements single-writer/multiple-reader semantics. This is a value type.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000612 RID: 1554
[ComVisible(true)]
public struct LockCookie
{
// Token: 0x060038CC RID: 14540 RVA: 0x000C42BC File Offset: 0x000C24BC
internal LockCookie(int thread_id)
{
this.ThreadId = thread_id;
this.ReaderLocks = 0;
this.WriterLocks = 0;
}
// Token: 0x060038CD RID: 14541 RVA: 0x000C42D4 File Offset: 0x000C24D4
internal LockCookie(int thread_id, int reader_locks, int writer_locks)
{
this.ThreadId = thread_id;
this.ReaderLocks = reader_locks;
this.WriterLocks = writer_locks;
}
/// <summary>Returns the hash code for this instance.</summary>
/// <returns>A 32-bit signed integer hash code.</returns>
// Token: 0x060038CE RID: 14542 RVA: 0x000C42EC File Offset: 0x000C24EC
public override int GetHashCode()
{
return base.GetHashCode();
}
/// <summary>Indicates whether the current instance is equal to the specified <see cref="T:System.Threading.LockCookie" />.</summary>
/// <returns>true if <paramref name="obj" /> is equal to the value of the current instance; otherwise, false.</returns>
/// <param name="obj">The <see cref="T:System.Threading.LockCookie" /> to compare to the current instance.</param>
// Token: 0x060038CF RID: 14543 RVA: 0x000C4300 File Offset: 0x000C2500
public bool Equals(LockCookie obj)
{
return this.ThreadId == obj.ThreadId && this.ReaderLocks == obj.ReaderLocks && this.WriterLocks == obj.WriterLocks;
}
/// <summary>Indicates whether a specified object is a <see cref="T:System.Threading.LockCookie" /> and is equal to the current instance.</summary>
/// <returns>true if the value of <paramref name="obj" /> is equal to the value of the current instance; otherwise, false.</returns>
/// <param name="obj">The object to compare to the current instance.</param>
// Token: 0x060038D0 RID: 14544 RVA: 0x000C433C File Offset: 0x000C253C
public override bool Equals(object obj)
{
return obj is LockCookie && obj.Equals(this);
}
/// <summary>Indicates whether two <see cref="T:System.Threading.LockCookie" /> structures are equal.</summary>
/// <returns>true if <paramref name="a" /> is equal to <paramref name="b" />; otherwise, false.</returns>
/// <param name="a">The <see cref="T:System.Threading.LockCookie" /> to compare to <paramref name="b" />.</param>
/// <param name="b">The <see cref="T:System.Threading.LockCookie" /> to compare to <paramref name="a" />.</param>
// Token: 0x060038D1 RID: 14545 RVA: 0x000C435C File Offset: 0x000C255C
public static bool operator ==(LockCookie a, LockCookie b)
{
return a.Equals(b);
}
/// <summary>Indicates whether two <see cref="T:System.Threading.LockCookie" /> structures are not equal.</summary>
/// <returns>true if <paramref name="a" /> is not equal to <paramref name="b" />; otherwise, false.</returns>
/// <param name="a">The <see cref="T:System.Threading.LockCookie" /> to compare to <paramref name="b" />.</param>
/// <param name="b">The <see cref="T:System.Threading.LockCookie" /> to compare to <paramref name="a" />.</param>
// Token: 0x060038D2 RID: 14546 RVA: 0x000C4368 File Offset: 0x000C2568
public static bool operator !=(LockCookie a, LockCookie b)
{
return !a.Equals(b);
}
// Token: 0x040016EC RID: 5868
internal int ThreadId;
// Token: 0x040016ED RID: 5869
internal int ReaderLocks;
// Token: 0x040016EE RID: 5870
internal int WriterLocks;
}
}
+79
View File
@@ -0,0 +1,79 @@
using System;
namespace System.Threading
{
// Token: 0x02000613 RID: 1555
internal class LockQueue
{
// Token: 0x060038D3 RID: 14547 RVA: 0x000C4378 File Offset: 0x000C2578
public LockQueue(ReaderWriterLock rwlock)
{
this.rwlock = rwlock;
}
// Token: 0x060038D4 RID: 14548 RVA: 0x000C4388 File Offset: 0x000C2588
public bool Wait(int timeout)
{
bool flag = false;
bool flag2;
try
{
lock (this)
{
this.lockCount++;
Monitor.Exit(this.rwlock);
flag = true;
flag2 = Monitor.Wait(this, timeout);
}
}
finally
{
if (flag)
{
Monitor.Enter(this.rwlock);
this.lockCount--;
}
}
return flag2;
}
// Token: 0x17000B02 RID: 2818
// (get) Token: 0x060038D5 RID: 14549 RVA: 0x000C4430 File Offset: 0x000C2630
public bool IsEmpty
{
get
{
bool flag;
lock (this)
{
flag = this.lockCount == 0;
}
return flag;
}
}
// Token: 0x060038D6 RID: 14550 RVA: 0x000C4480 File Offset: 0x000C2680
public void Pulse()
{
lock (this)
{
Monitor.Pulse(this);
}
}
// Token: 0x060038D7 RID: 14551 RVA: 0x000C44C4 File Offset: 0x000C26C4
public void PulseAll()
{
lock (this)
{
Monitor.PulseAll(this);
}
}
// Token: 0x040016EF RID: 5871
private ReaderWriterLock rwlock;
// Token: 0x040016F0 RID: 5872
private int lockCount;
}
}
@@ -0,0 +1,20 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Notifies one or more waiting threads that an event has occurred. This class cannot be inherited.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000614 RID: 1556
[ComVisible(true)]
public sealed class ManualResetEvent : EventWaitHandle
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ManualResetEvent" /> class with a Boolean value indicating whether to set the initial state to signaled.</summary>
/// <param name="initialState">true to set the initial state to signaled; false to set the initial state to nonsignaled. </param>
// Token: 0x060038D8 RID: 14552 RVA: 0x000C4508 File Offset: 0x000C2708
public ManualResetEvent(bool initialState)
: base(initialState, EventResetMode.ManualReset)
{
}
}
}
+271
View File
@@ -0,0 +1,271 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Contexts;
namespace System.Threading
{
/// <summary>Provides a mechanism that synchronizes access to objects.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000615 RID: 1557
[ComVisible(true)]
public static class Monitor
{
// Token: 0x060038D9 RID: 14553
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool Monitor_try_enter(object obj, int ms);
/// <summary>Acquires an exclusive lock on the specified object.</summary>
/// <param name="obj">The object on which to acquire the monitor lock. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038DA RID: 14554
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void Enter(object obj);
/// <summary>Releases an exclusive lock on the specified object.</summary>
/// <param name="obj">The object on which to release the lock. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">The current thread does not own the lock for the specified object. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038DB RID: 14555
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void Exit(object obj);
// Token: 0x060038DC RID: 14556
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Monitor_pulse(object obj);
// Token: 0x060038DD RID: 14557
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool Monitor_test_synchronised(object obj);
/// <summary>Notifies a thread in the waiting queue of a change in the locked object's state.</summary>
/// <param name="obj">The object a thread is waiting for. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">The calling thread does not own the lock for the specified object. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038DE RID: 14558 RVA: 0x000C4514 File Offset: 0x000C2714
public static void Pulse(object obj)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (!Monitor.Monitor_test_synchronised(obj))
{
throw new SynchronizationLockException("Object is not synchronized");
}
Monitor.Monitor_pulse(obj);
}
// Token: 0x060038DF RID: 14559
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Monitor_pulse_all(object obj);
/// <summary>Notifies all waiting threads of a change in the object's state.</summary>
/// <param name="obj">The object that sends the pulse. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">The calling thread does not own the lock for the specified object. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E0 RID: 14560 RVA: 0x000C4544 File Offset: 0x000C2744
public static void PulseAll(object obj)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (!Monitor.Monitor_test_synchronised(obj))
{
throw new SynchronizationLockException("Object is not synchronized");
}
Monitor.Monitor_pulse_all(obj);
}
/// <summary>Attempts to acquire an exclusive lock on the specified object.</summary>
/// <returns>true if the current thread acquires the lock; otherwise, false.</returns>
/// <param name="obj">The object on which to acquire the lock. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E1 RID: 14561 RVA: 0x000C4574 File Offset: 0x000C2774
public static bool TryEnter(object obj)
{
return Monitor.TryEnter(obj, 0);
}
/// <summary>Attempts, for the specified number of milliseconds, to acquire an exclusive lock on the specified object.</summary>
/// <returns>true if the current thread acquires the lock; otherwise, false.</returns>
/// <param name="obj">The object on which to acquire the lock. </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait for the lock. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is negative, and not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E2 RID: 14562 RVA: 0x000C4580 File Offset: 0x000C2780
public static bool TryEnter(object obj, int millisecondsTimeout)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (millisecondsTimeout == -1)
{
Monitor.Enter(obj);
return true;
}
if (millisecondsTimeout < 0)
{
throw new ArgumentException("negative value for millisecondsTimeout", "millisecondsTimeout");
}
return Monitor.Monitor_try_enter(obj, millisecondsTimeout);
}
/// <summary>Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.</summary>
/// <returns>true if the current thread acquires the lock without blocking; otherwise, false.</returns>
/// <param name="obj">The object on which to acquire the lock. </param>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> representing the amount of time to wait for the lock. A value of 1 millisecond specifies an infinite wait.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="timeout" /> in milliseconds is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> (1 millisecond), or is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E3 RID: 14563 RVA: 0x000C45CC File Offset: 0x000C27CC
public static bool TryEnter(object obj, TimeSpan timeout)
{
long num = (long)timeout.TotalMilliseconds;
if (num < -1L || num > 2147483647L)
{
throw new ArgumentOutOfRangeException("timeout", "timeout out of range");
}
return Monitor.TryEnter(obj, (int)num);
}
// Token: 0x060038E4 RID: 14564
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool Monitor_wait(object obj, int ms);
/// <summary>Releases the lock on an object and blocks the current thread until it reacquires the lock.</summary>
/// <returns>true if the call returned because the caller reacquired the lock for the specified object. This method does not return if the lock is not reacquired.</returns>
/// <param name="obj">The object on which to wait. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">The calling thread does not own the lock for the specified object. </exception>
/// <exception cref="T:System.Threading.ThreadInterruptedException">The thread that invokes Wait is later interrupted from the waiting state. This happens when another thread calls this thread's <see cref="M:System.Threading.Thread.Interrupt" /> method. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E5 RID: 14565 RVA: 0x000C4610 File Offset: 0x000C2810
public static bool Wait(object obj)
{
return Monitor.Wait(obj, -1);
}
/// <summary>Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue.</summary>
/// <returns>true if the lock was reacquired before the specified time elapsed; false if the lock was reacquired after the specified time elapsed. The method does not return until the lock is reacquired.</returns>
/// <param name="obj">The object on which to wait. </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait before the thread enters the ready queue. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">The calling thread does not own the lock for the specified object. </exception>
/// <exception cref="T:System.Threading.ThreadInterruptedException">The thread that invokes Wait is later interrupted from the waiting state. This happens when another thread calls this thread's <see cref="M:System.Threading.Thread.Interrupt" /> method. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of the <paramref name="millisecondsTimeout" /> parameter is negative, and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E6 RID: 14566 RVA: 0x000C461C File Offset: 0x000C281C
public static bool Wait(object obj, int millisecondsTimeout)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException("millisecondsTimeout", "timeout out of range");
}
if (!Monitor.Monitor_test_synchronised(obj))
{
throw new SynchronizationLockException("Object is not synchronized");
}
return Monitor.Monitor_wait(obj, millisecondsTimeout);
}
/// <summary>Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue.</summary>
/// <returns>true if the lock was reacquired before the specified time elapsed; false if the lock was reacquired after the specified time elapsed. The method does not return until the lock is reacquired.</returns>
/// <param name="obj">The object on which to wait. </param>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> representing the amount of time to wait before the thread enters the ready queue. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">The calling thread does not own the lock for the specified object. </exception>
/// <exception cref="T:System.Threading.ThreadInterruptedException">The thread that invokes Wait is later interrupted from the waiting state. This happens when another thread calls this thread's <see cref="M:System.Threading.Thread.Interrupt" /> method. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of the <paramref name="timeout" /> parameter in milliseconds is negative and does not represent <see cref="F:System.Threading.Timeout.Infinite" /> (1 millisecond), or is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E7 RID: 14567 RVA: 0x000C4670 File Offset: 0x000C2870
public static bool Wait(object obj, TimeSpan timeout)
{
long num = (long)timeout.TotalMilliseconds;
if (num < -1L || num > 2147483647L)
{
throw new ArgumentOutOfRangeException("timeout", "timeout out of range");
}
return Monitor.Wait(obj, (int)num);
}
/// <summary>Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue. This method also specifies whether the synchronization domain for the context (if in a synchronized context) is exited before the wait and reacquired afterward.</summary>
/// <returns>true if the lock was reacquired before the specified time elapsed; false if the lock was reacquired after the specified time elapsed. The method does not return until the lock is reacquired.</returns>
/// <param name="obj">The object on which to wait. </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait before the thread enters the ready queue. </param>
/// <param name="exitContext">true to exit and reacquire the synchronization domain for the context (if in a synchronized context) before the wait; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">Wait is not invoked from within a synchronized block of code. </exception>
/// <exception cref="T:System.Threading.ThreadInterruptedException">The thread that invokes Wait is later interrupted from the waiting state. This happens when another thread calls this thread's <see cref="M:System.Threading.Thread.Interrupt" /> method. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of the <paramref name="millisecondsTimeout" /> parameter is negative, and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E8 RID: 14568 RVA: 0x000C46B4 File Offset: 0x000C28B4
public static bool Wait(object obj, int millisecondsTimeout, bool exitContext)
{
bool flag;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
flag = Monitor.Wait(obj, millisecondsTimeout);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
}
return flag;
}
/// <summary>Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue. Optionally exits the synchronization domain for the synchronized context before the wait and reacquires the domain afterward.</summary>
/// <returns>true if the lock was reacquired before the specified time elapsed; false if the lock was reacquired after the specified time elapsed. The method does not return until the lock is reacquired.</returns>
/// <param name="obj">The object on which to wait. </param>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> representing the amount of time to wait before the thread enters the ready queue. </param>
/// <param name="exitContext">true to exit and reacquire the synchronization domain for the context (if in a synchronized context) before the wait; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="obj" /> parameter is null. </exception>
/// <exception cref="T:System.Threading.SynchronizationLockException">Wait is not invoked from within a synchronized block of code. </exception>
/// <exception cref="T:System.Threading.ThreadInterruptedException">The thread that invokes Wait is later interrupted from the waiting state. This happens when another thread calls this thread's <see cref="M:System.Threading.Thread.Interrupt" /> method. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="timeout" /> parameter is negative and does not represent <see cref="F:System.Threading.Timeout.Infinite" /> (1 millisecond), or is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038E9 RID: 14569 RVA: 0x000C4708 File Offset: 0x000C2908
public static bool Wait(object obj, TimeSpan timeout, bool exitContext)
{
bool flag;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
flag = Monitor.Wait(obj, timeout);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
}
return flag;
}
}
}
+86
View File
@@ -0,0 +1,86 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>A synchronization primitive that can also be used for interprocess synchronization. </summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000616 RID: 1558
[ComVisible(true)]
public sealed class Mutex : WaitHandle
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Mutex" /> class with default properties.</summary>
// Token: 0x060038EA RID: 14570 RVA: 0x000C475C File Offset: 0x000C295C
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public Mutex()
{
bool flag;
this.Handle = Mutex.CreateMutex_internal(false, null, out flag);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Mutex" /> class with a Boolean value that indicates whether the calling thread should have initial ownership of the mutex.</summary>
/// <param name="initiallyOwned">true to give the calling thread initial ownership of the mutex; otherwise, false. </param>
// Token: 0x060038EB RID: 14571 RVA: 0x000C4780 File Offset: 0x000C2980
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public Mutex(bool initiallyOwned)
{
bool flag;
this.Handle = Mutex.CreateMutex_internal(initiallyOwned, null, out flag);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Mutex" /> class with a Boolean value that indicates whether the calling thread should have initial ownership of the mutex, and a string that is the name of the mutex.</summary>
/// <param name="initiallyOwned">true to give the calling thread initial ownership of the named system mutex if the named system mutex is created as a result of this call; otherwise, false. </param>
/// <param name="name">The name of the <see cref="T:System.Threading.Mutex" />. If the value is null, the <see cref="T:System.Threading.Mutex" /> is unnamed. </param>
/// <exception cref="T:System.UnauthorizedAccessException">The named mutex exists and has access control security, but the user does not have <see cref="F:System.Security.AccessControl.MutexRights.FullControl" />.</exception>
/// <exception cref="T:System.IO.IOException">A Win32 error occurred.</exception>
/// <exception cref="T:System.ApplicationException">The named mutex cannot be created, perhaps because a wait handle of a different type has the same name.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> is longer than 260 characters.</exception>
// Token: 0x060038EC RID: 14572 RVA: 0x000C47A4 File Offset: 0x000C29A4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public Mutex(bool initiallyOwned, string name)
{
bool flag;
this.Handle = Mutex.CreateMutex_internal(initiallyOwned, name, out flag);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Mutex" /> class with a Boolean value that indicates whether the calling thread should have initial ownership of the mutex, a string that is the name of the mutex, and a Boolean value that, when the method returns, indicates whether the calling thread was granted initial ownership of the mutex.</summary>
/// <param name="initiallyOwned">true to give the calling thread initial ownership of the named system mutex if the named system mutex is created as a result of this call; otherwise, false. </param>
/// <param name="name">The name of the <see cref="T:System.Threading.Mutex" />. If the value is null, the <see cref="T:System.Threading.Mutex" /> is unnamed. </param>
/// <param name="createdNew">When this method returns, contains a Boolean that is true if a local mutex was created (that is, if <paramref name="name" /> is null or an empty string) or if the specified named system mutex was created; false if the specified named system mutex already existed. This parameter is passed uninitialized. </param>
/// <exception cref="T:System.UnauthorizedAccessException">The named mutex exists and has access control security, but the user does not have <see cref="F:System.Security.AccessControl.MutexRights.FullControl" />.</exception>
/// <exception cref="T:System.IO.IOException">A Win32 error occurred.</exception>
/// <exception cref="T:System.ApplicationException">The named mutex cannot be created, perhaps because a wait handle of a different type has the same name.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> is longer than 260 characters.</exception>
// Token: 0x060038ED RID: 14573 RVA: 0x000C47C8 File Offset: 0x000C29C8
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public Mutex(bool initiallyOwned, string name, out bool createdNew)
{
this.Handle = Mutex.CreateMutex_internal(initiallyOwned, name, out createdNew);
}
// Token: 0x060038EE RID: 14574
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern IntPtr CreateMutex_internal(bool initiallyOwned, string name, out bool created);
// Token: 0x060038EF RID: 14575
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool ReleaseMutex_internal(IntPtr handle);
/// <summary>Releases the <see cref="T:System.Threading.Mutex" /> once.</summary>
/// <exception cref="T:System.ApplicationException">The calling thread does not own the mutex. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038F0 RID: 14576 RVA: 0x000C47E0 File Offset: 0x000C29E0
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public void ReleaseMutex()
{
if (!Mutex.ReleaseMutex_internal(this.Handle))
{
throw new ApplicationException("Mutex is not owned");
}
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Runtime.CompilerServices;
namespace System.Threading
{
// Token: 0x02000617 RID: 1559
internal sealed class NativeEventCalls
{
// Token: 0x060038F2 RID: 14578
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern IntPtr CreateEvent_internal(bool manual, bool initial, string name, out bool created);
// Token: 0x060038F3 RID: 14579
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool SetEvent_internal(IntPtr handle);
// Token: 0x060038F4 RID: 14580
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool ResetEvent_internal(IntPtr handle);
// Token: 0x060038F5 RID: 14581
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void CloseEvent_internal(IntPtr handle);
}
}
@@ -0,0 +1,43 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Provides an explicit layout that is visible from unmanaged code and that will have the same layout as the Win32 OVERLAPPED structure with additional reserved fields at the end.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000618 RID: 1560
[ComVisible(true)]
public struct NativeOverlapped
{
/// <summary>Specifies the handle to an event set to the signaled state when the operation is complete. The calling process must set this member either to zero or to a valid event handle before calling any overlapped functions.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x040016F1 RID: 5873
public IntPtr EventHandle;
/// <summary>Specifies the length of the data transferred. Reserved for operating system use.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x040016F2 RID: 5874
public IntPtr InternalHigh;
/// <summary>Specifies a system-dependent status. Reserved for operating system use.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x040016F3 RID: 5875
public IntPtr InternalLow;
/// <summary>Specifies the high word of the byte offset at which to start the transfer.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x040016F4 RID: 5876
public int OffsetHigh;
/// <summary>Specifies a file position at which to start the transfer.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x040016F5 RID: 5877
public int OffsetLow;
// Token: 0x040016F6 RID: 5878
internal int Handle1;
// Token: 0x040016F7 RID: 5879
internal int Handle2;
}
}
+263
View File
@@ -0,0 +1,263 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Provides a managed representation of a Win32 OVERLAPPED structure, including methods to transfer information from an <see cref="T:System.Threading.Overlapped" /> instance to a <see cref="T:System.Threading.NativeOverlapped" /> structure.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000619 RID: 1561
[ComVisible(true)]
public class Overlapped
{
/// <summary>Initializes a new, empty instance of the <see cref="T:System.Threading.Overlapped" /> class.</summary>
// Token: 0x060038F6 RID: 14582 RVA: 0x000C4814 File Offset: 0x000C2A14
public Overlapped()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Overlapped" /> class with the specified file position, the 32-bit integer handle to an event that is signaled when the I/O operation is complete, and an interface through which to return the results of the operation.</summary>
/// <param name="offsetLo">The low word of the file position at which to start the transfer. </param>
/// <param name="offsetHi">The high word of the file position at which to start the transfer. </param>
/// <param name="hEvent">The handle to an event that is signaled when the I/O operation is complete. </param>
/// <param name="ar">An object that implements the <see cref="T:System.IAsyncResult" /> interface and provides status information on the I/O operation. </param>
// Token: 0x060038F7 RID: 14583 RVA: 0x000C481C File Offset: 0x000C2A1C
[Obsolete("Not 64bit compatible. Please use the constructor that takes IntPtr for the event handle", false)]
public Overlapped(int offsetLo, int offsetHi, int hEvent, IAsyncResult ar)
{
this.offsetL = offsetLo;
this.offsetH = offsetHi;
this.evt = hEvent;
this.ares = ar;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Overlapped" /> class with the specified file position, the handle to an event that is signaled when the I/O operation is complete, and an interface through which to return the results of the operation.</summary>
/// <param name="offsetLo">The low word of the file position at which to start the transfer. </param>
/// <param name="offsetHi">The high word of the file position at which to start the transfer. </param>
/// <param name="hEvent">The handle to an event that is signaled when the I/O operation is complete. </param>
/// <param name="ar">An object that implements the <see cref="T:System.IAsyncResult" /> interface and provides status information on the I/O operation. </param>
// Token: 0x060038F8 RID: 14584 RVA: 0x000C4844 File Offset: 0x000C2A44
public Overlapped(int offsetLo, int offsetHi, IntPtr hEvent, IAsyncResult ar)
{
this.offsetL = offsetLo;
this.offsetH = offsetHi;
this.evt_ptr = hEvent;
this.ares = ar;
}
/// <summary>Frees the unmanaged memory associated with a native overlapped structure allocated by the <see cref="Overload:System.Threading.Overlapped.Pack" /> method.</summary>
/// <param name="nativeOverlappedPtr">A pointer to the <see cref="T:System.Threading.NativeOverlapped" /> structure to be freed.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="nativeOverlappedPtr" /> is null.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038F9 RID: 14585 RVA: 0x000C486C File Offset: 0x000C2A6C
[CLSCompliant(false)]
public unsafe static void Free(NativeOverlapped* nativeOverlappedPtr)
{
if ((IntPtr)((void*)nativeOverlappedPtr) == IntPtr.Zero)
{
throw new ArgumentNullException("nativeOverlappedPtr");
}
Marshal.FreeHGlobal((IntPtr)((void*)nativeOverlappedPtr));
}
/// <summary>Unpacks the specified unmanaged <see cref="T:System.Threading.NativeOverlapped" /> structure into a managed <see cref="T:System.Threading.Overlapped" /> object. </summary>
/// <returns>An <see cref="T:System.Threading.Overlapped" /> object containing the information unpacked from the native structure.</returns>
/// <param name="nativeOverlappedPtr">An unmanaged pointer to a <see cref="T:System.Threading.NativeOverlapped" /> structure.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="nativeOverlappedPtr" /> is null.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060038FA RID: 14586 RVA: 0x000C489C File Offset: 0x000C2A9C
[CLSCompliant(false)]
public unsafe static Overlapped Unpack(NativeOverlapped* nativeOverlappedPtr)
{
if ((IntPtr)((void*)nativeOverlappedPtr) == IntPtr.Zero)
{
throw new ArgumentNullException("nativeOverlappedPtr");
}
return new Overlapped
{
offsetL = nativeOverlappedPtr->OffsetLow,
offsetH = nativeOverlappedPtr->OffsetHigh,
evt = (int)nativeOverlappedPtr->EventHandle
};
}
/// <summary>Packs the current instance into a <see cref="T:System.Threading.NativeOverlapped" /> structure, specifying the delegate to be invoked when the asynchronous I/O operation is complete.</summary>
/// <returns>An unmanaged pointer to a <see cref="T:System.Threading.NativeOverlapped" /> structure. </returns>
/// <param name="iocb">An <see cref="T:System.Threading.IOCompletionCallback" /> delegate that represents the callback method invoked when the asynchronous I/O operation completes.</param>
/// <exception cref="T:System.InvalidOperationException">The current <see cref="T:System.Threading.Overlapped" /> has already been packed.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060038FB RID: 14587 RVA: 0x000C48FC File Offset: 0x000C2AFC
[MonoTODO("Security - we need to propagate the call stack")]
[Obsolete("Use Pack(iocb, userData) instead", false)]
[CLSCompliant(false)]
public unsafe NativeOverlapped* Pack(IOCompletionCallback iocb)
{
NativeOverlapped* ptr = (NativeOverlapped*)(void*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeOverlapped)));
ptr->OffsetLow = this.offsetL;
ptr->OffsetHigh = this.offsetH;
ptr->EventHandle = (IntPtr)this.evt;
return ptr;
}
/// <summary>Packs the current instance into a <see cref="T:System.Threading.NativeOverlapped" /> structure, specifying a delegate that is invoked when the asynchronous I/O operation is complete and a managed object that serves as a buffer.</summary>
/// <returns>An unmanaged pointer to a <see cref="T:System.Threading.NativeOverlapped" /> structure. </returns>
/// <param name="iocb">An <see cref="T:System.Threading.IOCompletionCallback" /> delegate that represents the callback method invoked when the asynchronous I/O operation completes.</param>
/// <param name="userData">An object or array of objects representing the input or output buffer for the operation. Each object represents a buffer, for example an array of bytes.</param>
/// <exception cref="T:System.InvalidOperationException">The current <see cref="T:System.Threading.Overlapped" /> has already been packed.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060038FC RID: 14588 RVA: 0x000C4950 File Offset: 0x000C2B50
[MonoTODO("handle userData")]
[CLSCompliant(false)]
[ComVisible(false)]
public unsafe NativeOverlapped* Pack(IOCompletionCallback iocb, object userData)
{
NativeOverlapped* ptr = (NativeOverlapped*)(void*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeOverlapped)));
ptr->OffsetLow = this.offsetL;
ptr->OffsetHigh = this.offsetH;
ptr->EventHandle = this.evt_ptr;
return ptr;
}
/// <summary>Packs the current instance into a <see cref="T:System.Threading.NativeOverlapped" /> structure specifying the delegate to invoke when the asynchronous I/O operation is complete. Does not propagate the calling stack.</summary>
/// <returns>An unmanaged pointer to a <see cref="T:System.Threading.NativeOverlapped" /> structure. </returns>
/// <param name="iocb">An <see cref="T:System.Threading.IOCompletionCallback" /> delegate that represents the callback method invoked when the asynchronous I/O operation completes.</param>
/// <exception cref="T:System.InvalidOperationException">The current <see cref="T:System.Threading.Overlapped" /> has already been packed.</exception>
/// <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: 0x060038FD RID: 14589 RVA: 0x000C499C File Offset: 0x000C2B9C
[Obsolete("Use UnsafePack(iocb, userData) instead", false)]
[CLSCompliant(false)]
public unsafe NativeOverlapped* UnsafePack(IOCompletionCallback iocb)
{
return this.Pack(iocb);
}
/// <summary>Packs the current instance into a <see cref="T:System.Threading.NativeOverlapped" /> structure, specifying the delegate to invoke when the asynchronous I/O operation is complete and the managed object that serves as a buffer. Does not propagate the calling stack.</summary>
/// <returns>An unmanaged pointer to a <see cref="T:System.Threading.NativeOverlapped" /> structure. </returns>
/// <param name="iocb">An <see cref="T:System.Threading.IOCompletionCallback" /> delegate that represents the callback method invoked when the asynchronous I/O operation completes.</param>
/// <param name="userData">An object or array of objects representing the input or output buffer for the operation. Each object represents a buffer, for example an array of bytes.</param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <exception cref="T:System.InvalidOperationException">The current <see cref="T:System.Threading.Overlapped" /> is already packed.</exception>
/// <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: 0x060038FE RID: 14590 RVA: 0x000C49A8 File Offset: 0x000C2BA8
[ComVisible(false)]
[CLSCompliant(false)]
public unsafe NativeOverlapped* UnsafePack(IOCompletionCallback iocb, object userData)
{
return this.Pack(iocb, userData);
}
/// <summary>Gets or sets the object that provides status information on the I/O operation.</summary>
/// <returns>An object that implements the <see cref="T:System.IAsyncResult" /> interface.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B03 RID: 2819
// (get) Token: 0x060038FF RID: 14591 RVA: 0x000C49B4 File Offset: 0x000C2BB4
// (set) Token: 0x06003900 RID: 14592 RVA: 0x000C49BC File Offset: 0x000C2BBC
public IAsyncResult AsyncResult
{
get
{
return this.ares;
}
set
{
this.ares = value;
}
}
/// <summary>Gets or sets the 32-bit integer handle to a synchronization event that is signaled when the I/O operation is complete.</summary>
/// <returns>An <see cref="T:System.Int32" /> value representing the handle of the synchronization event.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B04 RID: 2820
// (get) Token: 0x06003901 RID: 14593 RVA: 0x000C49C8 File Offset: 0x000C2BC8
// (set) Token: 0x06003902 RID: 14594 RVA: 0x000C49D0 File Offset: 0x000C2BD0
[Obsolete("Not 64bit compatible. Use EventHandleIntPtr instead.", false)]
public int EventHandle
{
get
{
return this.evt;
}
set
{
this.evt = value;
}
}
/// <summary>Gets or sets the handle to the synchronization event that is signaled when the I/O operation is complete.</summary>
/// <returns>An <see cref="T:System.IntPtr" /> representing the handle of the event.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B05 RID: 2821
// (get) Token: 0x06003903 RID: 14595 RVA: 0x000C49DC File Offset: 0x000C2BDC
// (set) Token: 0x06003904 RID: 14596 RVA: 0x000C49E4 File Offset: 0x000C2BE4
[ComVisible(false)]
public IntPtr EventHandleIntPtr
{
get
{
return this.evt_ptr;
}
set
{
this.evt_ptr = value;
}
}
/// <summary>Gets or sets the high-order word of the file position at which to start the transfer. The file position is a byte offset from the start of the file.</summary>
/// <returns>An <see cref="T:System.Int32" /> value representing the high word of the file position.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B06 RID: 2822
// (get) Token: 0x06003905 RID: 14597 RVA: 0x000C49F0 File Offset: 0x000C2BF0
// (set) Token: 0x06003906 RID: 14598 RVA: 0x000C49F8 File Offset: 0x000C2BF8
public int OffsetHigh
{
get
{
return this.offsetH;
}
set
{
this.offsetH = value;
}
}
/// <summary>Gets or sets the low-order word of the file position at which to start the transfer. The file position is a byte offset from the start of the file.</summary>
/// <returns>An <see cref="T:System.Int32" /> value representing the low word of the file position.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B07 RID: 2823
// (get) Token: 0x06003907 RID: 14599 RVA: 0x000C4A04 File Offset: 0x000C2C04
// (set) Token: 0x06003908 RID: 14600 RVA: 0x000C4A0C File Offset: 0x000C2C0C
public int OffsetLow
{
get
{
return this.offsetL;
}
set
{
this.offsetL = value;
}
}
// Token: 0x040016F8 RID: 5880
private IAsyncResult ares;
// Token: 0x040016F9 RID: 5881
private int offsetL;
// Token: 0x040016FA RID: 5882
private int offsetH;
// Token: 0x040016FB RID: 5883
private int evt;
// Token: 0x040016FC RID: 5884
private IntPtr evt_ptr;
}
}
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents the method that executes on a <see cref="T:System.Threading.Thread" />.</summary>
/// <param name="obj">An object that contains data for the thread procedure.</param>
/// <filterpriority>1</filterpriority>
// Token: 0x020006DE RID: 1758
// (Invoke) Token: 0x06004200 RID: 16896
[ComVisible(false)]
public delegate void ParameterizedThreadStart(object obj);
}
@@ -0,0 +1,466 @@
using System;
using System.Collections;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Defines a lock that supports single writers and multiple readers. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200061A RID: 1562
[ComVisible(true)]
public sealed class ReaderWriterLock : CriticalFinalizerObject
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ReaderWriterLock" /> class.</summary>
// Token: 0x06003909 RID: 14601 RVA: 0x000C4A18 File Offset: 0x000C2C18
public ReaderWriterLock()
{
this.writer_queue = new LockQueue(this);
this.reader_locks = new Hashtable();
GC.SuppressFinalize(this);
}
// Token: 0x0600390A RID: 14602 RVA: 0x000C4A50 File Offset: 0x000C2C50
[MonoTODO]
~ReaderWriterLock()
{
}
/// <summary>Gets a value indicating whether the current thread holds a reader lock.</summary>
/// <returns>true if the current thread holds a reader lock; otherwise, false.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B08 RID: 2824
// (get) Token: 0x0600390B RID: 14603 RVA: 0x000C4A88 File Offset: 0x000C2C88
public bool IsReaderLockHeld
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
get
{
bool flag;
lock (this)
{
flag = this.reader_locks.ContainsKey(Thread.CurrentThreadId);
}
return flag;
}
}
/// <summary>Gets a value indicating whether the current thread holds the writer lock.</summary>
/// <returns>true if the current thread holds the writer lock; otherwise, false.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B09 RID: 2825
// (get) Token: 0x0600390C RID: 14604 RVA: 0x000C4AE4 File Offset: 0x000C2CE4
public bool IsWriterLockHeld
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
get
{
bool flag;
lock (this)
{
flag = this.state < 0 && Thread.CurrentThreadId == this.writer_lock_owner;
}
return flag;
}
}
/// <summary>Gets the current sequence number.</summary>
/// <returns>The current sequence number.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B0A RID: 2826
// (get) Token: 0x0600390D RID: 14605 RVA: 0x000C4B44 File Offset: 0x000C2D44
public int WriterSeqNum
{
get
{
int num;
lock (this)
{
num = this.seq_num;
}
return num;
}
}
/// <summary>Acquires a reader lock, using an <see cref="T:System.Int32" /> value for the time-out.</summary>
/// <param name="millisecondsTimeout">The time-out in milliseconds. </param>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="millisecondsTimeout" /> expires before the lock request is granted. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x0600390E RID: 14606 RVA: 0x000C4B90 File Offset: 0x000C2D90
public void AcquireReaderLock(int millisecondsTimeout)
{
this.AcquireReaderLock(millisecondsTimeout, 1);
}
// Token: 0x0600390F RID: 14607 RVA: 0x000C4B9C File Offset: 0x000C2D9C
private void AcquireReaderLock(int millisecondsTimeout, int initialLockCount)
{
lock (this)
{
if (this.HasWriterLock())
{
this.AcquireWriterLock(millisecondsTimeout, initialLockCount);
}
else
{
object obj = this.reader_locks[Thread.CurrentThreadId];
if (obj == null)
{
this.readers++;
try
{
if (this.state < 0 || !this.writer_queue.IsEmpty)
{
while (Monitor.Wait(this, millisecondsTimeout))
{
if (this.state >= 0)
{
goto IL_89;
}
}
throw new ApplicationException("Timeout expired");
}
IL_89:;
}
finally
{
this.readers--;
}
this.reader_locks[Thread.CurrentThreadId] = initialLockCount;
this.state += initialLockCount;
}
else
{
this.reader_locks[Thread.CurrentThreadId] = (int)obj + 1;
this.state++;
}
}
}
}
/// <summary>Acquires a reader lock, using a <see cref="T:System.TimeSpan" /> value for the time-out.</summary>
/// <param name="timeout">A TimeSpan specifying the time-out period. </param>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="timeout" /> expires before the lock request is granted. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> specifies a negative value other than -1 milliseconds. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003910 RID: 14608 RVA: 0x000C4CE4 File Offset: 0x000C2EE4
public void AcquireReaderLock(TimeSpan timeout)
{
int num = this.CheckTimeout(timeout);
this.AcquireReaderLock(num, 1);
}
/// <summary>Acquires the writer lock, using an <see cref="T:System.Int32" /> value for the time-out.</summary>
/// <param name="millisecondsTimeout">The time-out in milliseconds. </param>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="timeout" /> expires before the lock request is granted. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003911 RID: 14609 RVA: 0x000C4D04 File Offset: 0x000C2F04
public void AcquireWriterLock(int millisecondsTimeout)
{
this.AcquireWriterLock(millisecondsTimeout, 1);
}
// Token: 0x06003912 RID: 14610 RVA: 0x000C4D10 File Offset: 0x000C2F10
private void AcquireWriterLock(int millisecondsTimeout, int initialLockCount)
{
lock (this)
{
if (this.HasWriterLock())
{
this.state--;
}
else
{
if (this.state != 0 || !this.writer_queue.IsEmpty)
{
while (this.writer_queue.Wait(millisecondsTimeout))
{
if (this.state == 0)
{
goto IL_68;
}
}
throw new ApplicationException("Timeout expired");
}
IL_68:
this.state = -initialLockCount;
this.writer_lock_owner = Thread.CurrentThreadId;
this.seq_num++;
}
}
}
/// <summary>Acquires the writer lock, using a <see cref="T:System.TimeSpan" /> value for the time-out.</summary>
/// <param name="timeout">The TimeSpan specifying the time-out period. </param>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="timeout" /> expires before the lock request is granted. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> specifies a negative value other than -1 milliseconds. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003913 RID: 14611 RVA: 0x000C4DD0 File Offset: 0x000C2FD0
public void AcquireWriterLock(TimeSpan timeout)
{
int num = this.CheckTimeout(timeout);
this.AcquireWriterLock(num, 1);
}
/// <summary>Indicates whether the writer lock has been granted to any thread since the sequence number was obtained.</summary>
/// <returns>true if the writer lock has been granted to any thread since the sequence number was obtained; otherwise, false.</returns>
/// <param name="seqNum">The sequence number. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x06003914 RID: 14612 RVA: 0x000C4DF0 File Offset: 0x000C2FF0
public bool AnyWritersSince(int seqNum)
{
bool flag;
lock (this)
{
flag = this.seq_num > seqNum;
}
return flag;
}
/// <summary>Restores the lock status of the thread to what it was before <see cref="M:System.Threading.ReaderWriterLock.UpgradeToWriterLock(System.Int32)" /> was called.</summary>
/// <param name="lockCookie">A <see cref="T:System.Threading.LockCookie" /> returned by <see cref="M:System.Threading.ReaderWriterLock.UpgradeToWriterLock(System.Int32)" />. </param>
/// <exception cref="T:System.ApplicationException">The thread does not have the writer lock. </exception>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="lockCookie" /> is a null pointer. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003915 RID: 14613 RVA: 0x000C4E40 File Offset: 0x000C3040
public void DowngradeFromWriterLock(ref LockCookie lockCookie)
{
lock (this)
{
if (!this.HasWriterLock())
{
throw new ApplicationException("The thread does not have the writer lock.");
}
this.state = lockCookie.ReaderLocks;
this.reader_locks[Thread.CurrentThreadId] = this.state;
if (this.readers > 0)
{
Monitor.PulseAll(this);
}
}
}
/// <summary>Releases the lock, regardless of the number of times the thread acquired the lock.</summary>
/// <returns>A <see cref="T:System.Threading.LockCookie" /> value representing the released lock.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x06003916 RID: 14614 RVA: 0x000C4ED4 File Offset: 0x000C30D4
public LockCookie ReleaseLock()
{
LockCookie lockCookie;
lock (this)
{
lockCookie = this.GetLockCookie();
if (lockCookie.WriterLocks != 0)
{
this.ReleaseWriterLock(lockCookie.WriterLocks);
}
else if (lockCookie.ReaderLocks != 0)
{
this.ReleaseReaderLock(lockCookie.ReaderLocks, lockCookie.ReaderLocks);
}
}
return lockCookie;
}
/// <summary>Decrements the lock count.</summary>
/// <exception cref="T:System.ApplicationException">The thread does not have any reader or writer locks. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003917 RID: 14615 RVA: 0x000C4F58 File Offset: 0x000C3158
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public void ReleaseReaderLock()
{
lock (this)
{
if (!this.HasWriterLock())
{
if (this.state > 0)
{
object obj = this.reader_locks[Thread.CurrentThreadId];
if (obj != null)
{
this.ReleaseReaderLock((int)obj, 1);
return;
}
}
throw new ApplicationException("The thread does not have any reader or writer locks.");
}
this.ReleaseWriterLock();
}
}
// Token: 0x06003918 RID: 14616 RVA: 0x000C4FF0 File Offset: 0x000C31F0
private void ReleaseReaderLock(int currentCount, int releaseCount)
{
int num = currentCount - releaseCount;
if (num == 0)
{
this.reader_locks.Remove(Thread.CurrentThreadId);
}
else
{
this.reader_locks[Thread.CurrentThreadId] = num;
}
this.state -= releaseCount;
if (this.state == 0 && !this.writer_queue.IsEmpty)
{
this.writer_queue.Pulse();
}
}
/// <summary>Decrements the lock count on the writer lock.</summary>
/// <exception cref="T:System.ApplicationException">The thread does not have the writer lock. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003919 RID: 14617 RVA: 0x000C5070 File Offset: 0x000C3270
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public void ReleaseWriterLock()
{
lock (this)
{
if (!this.HasWriterLock())
{
throw new ApplicationException("The thread does not have the writer lock.");
}
this.ReleaseWriterLock(1);
}
}
// Token: 0x0600391A RID: 14618 RVA: 0x000C50CC File Offset: 0x000C32CC
private void ReleaseWriterLock(int releaseCount)
{
this.state += releaseCount;
if (this.state == 0)
{
if (this.readers > 0)
{
Monitor.PulseAll(this);
}
else if (!this.writer_queue.IsEmpty)
{
this.writer_queue.Pulse();
}
}
}
/// <summary>Restores the lock status of the thread to what it was before calling <see cref="M:System.Threading.ReaderWriterLock.ReleaseLock" />.</summary>
/// <param name="lockCookie">A <see cref="T:System.Threading.LockCookie" /> returned by <see cref="M:System.Threading.ReaderWriterLock.ReleaseLock" />. </param>
/// <exception cref="T:System.NullReferenceException">The address of <paramref name="lockCookie" /> is a null pointer. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x0600391B RID: 14619 RVA: 0x000C5124 File Offset: 0x000C3324
public void RestoreLock(ref LockCookie lockCookie)
{
lock (this)
{
if (lockCookie.WriterLocks != 0)
{
this.AcquireWriterLock(-1, lockCookie.WriterLocks);
}
else if (lockCookie.ReaderLocks != 0)
{
this.AcquireReaderLock(-1, lockCookie.ReaderLocks);
}
}
}
/// <summary>Upgrades a reader lock to the writer lock, using an Int32 value for the time-out.</summary>
/// <returns>A <see cref="T:System.Threading.LockCookie" /> value.</returns>
/// <param name="millisecondsTimeout">The time-out in milliseconds. </param>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="millisecondsTimeout" /> expires before the lock request is granted. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x0600391C RID: 14620 RVA: 0x000C5198 File Offset: 0x000C3398
public LockCookie UpgradeToWriterLock(int millisecondsTimeout)
{
LockCookie lockCookie;
lock (this)
{
lockCookie = this.GetLockCookie();
if (lockCookie.WriterLocks != 0)
{
this.state--;
return lockCookie;
}
if (lockCookie.ReaderLocks != 0)
{
this.ReleaseReaderLock(lockCookie.ReaderLocks, lockCookie.ReaderLocks);
}
}
this.AcquireWriterLock(millisecondsTimeout);
return lockCookie;
}
/// <summary>Upgrades a reader lock to the writer lock, using a TimeSpan value for the time-out.</summary>
/// <returns>A <see cref="T:System.Threading.LockCookie" /> value.</returns>
/// <param name="timeout">The TimeSpan specifying the time-out period. </param>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="timeout" /> expires before the lock request is granted. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> specifies a negative value other than -1 milliseconds. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x0600391D RID: 14621 RVA: 0x000C5228 File Offset: 0x000C3428
public LockCookie UpgradeToWriterLock(TimeSpan timeout)
{
int num = this.CheckTimeout(timeout);
return this.UpgradeToWriterLock(num);
}
// Token: 0x0600391E RID: 14622 RVA: 0x000C5244 File Offset: 0x000C3444
private LockCookie GetLockCookie()
{
LockCookie lockCookie = new LockCookie(Thread.CurrentThreadId);
if (this.HasWriterLock())
{
lockCookie.WriterLocks = -this.state;
}
else
{
object obj = this.reader_locks[Thread.CurrentThreadId];
if (obj != null)
{
lockCookie.ReaderLocks = (int)obj;
}
}
return lockCookie;
}
// Token: 0x0600391F RID: 14623 RVA: 0x000C52A8 File Offset: 0x000C34A8
private bool HasWriterLock()
{
return this.state < 0 && Thread.CurrentThreadId == this.writer_lock_owner;
}
// Token: 0x06003920 RID: 14624 RVA: 0x000C52C8 File Offset: 0x000C34C8
private int CheckTimeout(TimeSpan timeout)
{
int num = (int)timeout.TotalMilliseconds;
if (num < -1)
{
throw new ArgumentOutOfRangeException("timeout", "Number must be either non-negative or -1");
}
return num;
}
// Token: 0x040016FD RID: 5885
private int seq_num = 1;
// Token: 0x040016FE RID: 5886
private int state;
// Token: 0x040016FF RID: 5887
private int readers;
// Token: 0x04001700 RID: 5888
private LockQueue writer_queue;
// Token: 0x04001701 RID: 5889
private Hashtable reader_locks;
// Token: 0x04001702 RID: 5890
private int writer_lock_owner;
}
}
@@ -0,0 +1,129 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents a handle that has been registered when calling <see cref="M:System.Threading.ThreadPool.RegisterWaitForSingleObject(System.Threading.WaitHandle,System.Threading.WaitOrTimerCallback,System.Object,System.UInt32,System.Boolean)" />. This class cannot be inherited.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200061B RID: 1563
[ComVisible(true)]
public sealed class RegisteredWaitHandle : MarshalByRefObject
{
// Token: 0x06003921 RID: 14625 RVA: 0x000C52F8 File Offset: 0x000C34F8
internal RegisteredWaitHandle(WaitHandle waitObject, WaitOrTimerCallback callback, object state, TimeSpan timeout, bool executeOnlyOnce)
{
this._waitObject = waitObject;
this._callback = callback;
this._state = state;
this._timeout = timeout;
this._executeOnlyOnce = executeOnlyOnce;
this._finalEvent = null;
this._cancelEvent = new ManualResetEvent(false);
this._callsInProcess = 0;
this._unregistered = false;
}
// Token: 0x06003922 RID: 14626 RVA: 0x000C5354 File Offset: 0x000C3554
internal void Wait(object state)
{
try
{
WaitHandle[] array = new WaitHandle[] { this._waitObject, this._cancelEvent };
do
{
int num = WaitHandle.WaitAny(array, this._timeout, false);
if (!this._unregistered)
{
lock (this)
{
this._callsInProcess++;
}
ThreadPool.QueueUserWorkItem(new WaitCallback(this.DoCallBack), num == 258);
}
}
while (!this._unregistered && !this._executeOnlyOnce);
}
catch
{
}
lock (this)
{
this._unregistered = true;
if (this._callsInProcess == 0 && this._finalEvent != null)
{
NativeEventCalls.SetEvent_internal(this._finalEvent.Handle);
}
}
}
// Token: 0x06003923 RID: 14627 RVA: 0x000C5484 File Offset: 0x000C3684
private void DoCallBack(object timedOut)
{
if (this._callback != null)
{
this._callback(this._state, (bool)timedOut);
}
lock (this)
{
this._callsInProcess--;
if (this._unregistered && this._callsInProcess == 0 && this._finalEvent != null)
{
NativeEventCalls.SetEvent_internal(this._finalEvent.Handle);
}
}
}
/// <summary>Cancels a registered wait operation issued by the <see cref="M:System.Threading.ThreadPool.RegisterWaitForSingleObject(System.Threading.WaitHandle,System.Threading.WaitOrTimerCallback,System.Object,System.UInt32,System.Boolean)" /> method.</summary>
/// <returns>true if the function succeeds; otherwise, false.</returns>
/// <param name="waitObject">The <see cref="T:System.Threading.WaitHandle" /> to be signaled. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x06003924 RID: 14628 RVA: 0x000C5524 File Offset: 0x000C3724
[ComVisible(true)]
public bool Unregister(WaitHandle waitObject)
{
bool flag;
lock (this)
{
if (this._unregistered)
{
flag = false;
}
else
{
this._finalEvent = waitObject;
this._unregistered = true;
this._cancelEvent.Set();
flag = true;
}
}
return flag;
}
// Token: 0x04001703 RID: 5891
private WaitHandle _waitObject;
// Token: 0x04001704 RID: 5892
private WaitOrTimerCallback _callback;
// Token: 0x04001705 RID: 5893
private TimeSpan _timeout;
// Token: 0x04001706 RID: 5894
private object _state;
// Token: 0x04001707 RID: 5895
private bool _executeOnlyOnce;
// Token: 0x04001708 RID: 5896
private WaitHandle _finalEvent;
// Token: 0x04001709 RID: 5897
private ManualResetEvent _cancelEvent;
// Token: 0x0400170A RID: 5898
private int _callsInProcess;
// Token: 0x0400170B RID: 5899
private bool _unregistered;
}
}
@@ -0,0 +1,11 @@
using System;
namespace System.Threading
{
/// <summary>Represents a method to be called when a message is to be dispatched to a synchronization context. </summary>
/// <param name="state">The object passed to the delegate.</param>
/// <filterpriority>2</filterpriority>
// Token: 0x020006DF RID: 1759
// (Invoke) Token: 0x06004204 RID: 16900
public delegate void SendOrPostCallback(object state);
}
@@ -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;
}
}
@@ -0,0 +1,47 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading
{
/// <summary>The exception that is thrown when a method requires the caller to own the lock on a given Monitor, and the method is invoked by a caller that does not own that lock.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200061D RID: 1565
[ComVisible(true)]
[Serializable]
public class SynchronizationLockException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.SynchronizationLockException" /> class with default properties.</summary>
// Token: 0x06003933 RID: 14643 RVA: 0x000C5628 File Offset: 0x000C3828
public SynchronizationLockException()
: base("Synchronization Error")
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.SynchronizationLockException" /> class with a specified error message.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
// Token: 0x06003934 RID: 14644 RVA: 0x000C5638 File Offset: 0x000C3838
public SynchronizationLockException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.SynchronizationLockException" /> class with serialized data.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
// Token: 0x06003935 RID: 14645 RVA: 0x000C5644 File Offset: 0x000C3844
protected SynchronizationLockException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.SynchronizationLockException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
// Token: 0x06003936 RID: 14646 RVA: 0x000C5650 File Offset: 0x000C3850
public SynchronizationLockException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}
+1588
View File
@@ -0,0 +1,1588 @@
using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Contexts;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Principal;
namespace System.Threading
{
/// <summary>Creates and controls a thread, sets its priority, and gets its status.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x0200061E RID: 1566
[ComDefaultInterface(typeof(_Thread))]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public sealed class Thread : CriticalFinalizerObject, _Thread
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Thread" /> class.</summary>
/// <param name="start">A <see cref="T:System.Threading.ThreadStart" /> delegate that represents the methods to be invoked when this thread begins executing. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="start" /> parameter is null. </exception>
// Token: 0x06003937 RID: 14647 RVA: 0x000C565C File Offset: 0x000C385C
public Thread(ThreadStart start)
{
if (start == null)
{
throw new ArgumentNullException("Null ThreadStart");
}
this.threadstart = start;
this.Thread_init();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Thread" /> class, specifying the maximum stack size for the thread.</summary>
/// <param name="start">A <see cref="T:System.Threading.ThreadStart" /> delegate that represents the methods to be invoked when this thread begins executing.</param>
/// <param name="maxStackSize">The maximum stack size to be used by the thread, or 0 to use the default maximum stack size specified in the header for the executable.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="start" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="maxStackSize" /> is less than zero.</exception>
// Token: 0x06003938 RID: 14648 RVA: 0x000C568C File Offset: 0x000C388C
public Thread(ThreadStart start, int maxStackSize)
{
if (start == null)
{
throw new ArgumentNullException("start");
}
if (maxStackSize < 131072)
{
throw new ArgumentException("< 128 kb", "maxStackSize");
}
this.threadstart = start;
this.stack_size = maxStackSize;
this.Thread_init();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Thread" /> class, specifying a delegate that allows an object to be passed to the thread when the thread is started.</summary>
/// <param name="start">A <see cref="T:System.Threading.ParameterizedThreadStart" /> delegate that represents the methods to be invoked when this thread begins executing.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="start" /> is null. </exception>
// Token: 0x06003939 RID: 14649 RVA: 0x000C56E8 File Offset: 0x000C38E8
public Thread(ParameterizedThreadStart start)
{
if (start == null)
{
throw new ArgumentNullException("start");
}
this.threadstart = start;
this.Thread_init();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Thread" /> class, specifying a delegate that allows an object to be passed to the thread when the thread is started and specifying the maximum stack size for the thread.</summary>
/// <param name="start">A <see cref="T:System.Threading.ParameterizedThreadStart" /> delegate that represents the methods to be invoked when this thread begins executing.</param>
/// <param name="maxStackSize">The maximum stack size to be used by the thread, or 0 to use the default maximum stack size specified in the header for the executable.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="start" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="maxStackSize" /> is less than zero.</exception>
// Token: 0x0600393A RID: 14650 RVA: 0x000C5718 File Offset: 0x000C3918
public Thread(ParameterizedThreadStart start, int maxStackSize)
{
if (start == null)
{
throw new ArgumentNullException("start");
}
if (maxStackSize < 131072)
{
throw new ArgumentException("< 128 kb", "maxStackSize");
}
this.threadstart = start;
this.stack_size = maxStackSize;
this.Thread_init();
}
/// <summary>Maps a set of names to a corresponding set of dispatch identifiers.</summary>
/// <param name="riid">Reserved for future use. Must be IID_NULL.</param>
/// <param name="rgszNames">Passed-in array of names to be mapped.</param>
/// <param name="cNames">Count of the names to be mapped.</param>
/// <param name="lcid">The locale context in which to interpret the names.</param>
/// <param name="rgDispId">Caller-allocated array which receives the IDs corresponding to the names.</param>
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
// Token: 0x0600393C RID: 14652 RVA: 0x000C578C File Offset: 0x000C398C
void _Thread.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
throw new NotImplementedException();
}
/// <summary>Retrieves the type information for an object, which can then be used to get the type information for an interface.</summary>
/// <param name="iTInfo">The type information to return.</param>
/// <param name="lcid">The locale identifier for the type information.</param>
/// <param name="ppTInfo">Receives a pointer to the requested type information object.</param>
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
// Token: 0x0600393D RID: 14653 RVA: 0x000C5794 File Offset: 0x000C3994
void _Thread.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
{
throw new NotImplementedException();
}
/// <summary>Retrieves the number of type information interfaces that an object provides (either 0 or 1).</summary>
/// <param name="pcTInfo">Points to a location that receives the number of type information interfaces provided by the object.</param>
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
// Token: 0x0600393E RID: 14654 RVA: 0x000C579C File Offset: 0x000C399C
void _Thread.GetTypeInfoCount(out uint pcTInfo)
{
throw new NotImplementedException();
}
/// <summary>Provides access to properties and methods exposed by an object.</summary>
/// <param name="dispIdMember">Identifies the member.</param>
/// <param name="riid">Reserved for future use. Must be IID_NULL.</param>
/// <param name="lcid">The locale context in which to interpret arguments.</param>
/// <param name="wFlags">Flags describing the context of the call.</param>
/// <param name="pDispParams">Pointer to a structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.</param>
/// <param name="pVarResult">Pointer to the location where the result is to be stored.</param>
/// <param name="pExcepInfo">Pointer to a structure that contains exception information.</param>
/// <param name="puArgErr">The index of the first argument that has an error.</param>
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
// Token: 0x0600393F RID: 14655 RVA: 0x000C57A4 File Offset: 0x000C39A4
void _Thread.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
{
throw new NotImplementedException();
}
/// <summary>Gets the current context in which the thread is executing.</summary>
/// <returns>A <see cref="T:System.Runtime.Remoting.Contexts.Context" /> representing the current thread context.</returns>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000B0C RID: 2828
// (get) Token: 0x06003940 RID: 14656 RVA: 0x000C57AC File Offset: 0x000C39AC
public static Context CurrentContext
{
get
{
return AppDomain.InternalGetContext();
}
}
/// <summary>Gets or sets the thread's current principal (for role-based security).</summary>
/// <returns>An <see cref="T:System.Security.Principal.IPrincipal" /> value representing the security context.</returns>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the permission required to set the principal. </exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlPrincipal" />
/// </PermissionSet>
// Token: 0x17000B0D RID: 2829
// (get) Token: 0x06003941 RID: 14657 RVA: 0x000C57B4 File Offset: 0x000C39B4
// (set) Token: 0x06003942 RID: 14658 RVA: 0x000C5814 File Offset: 0x000C3A14
public static IPrincipal CurrentPrincipal
{
get
{
IPrincipal principal = null;
Thread currentThread = Thread.CurrentThread;
Thread thread = currentThread;
lock (thread)
{
principal = currentThread._principal;
if (principal == null)
{
principal = Thread.GetDomain().DefaultPrincipal;
}
}
return principal;
}
set
{
Thread currentThread = Thread.CurrentThread;
Thread thread = currentThread;
lock (thread)
{
currentThread._principal = value;
}
}
}
// Token: 0x06003943 RID: 14659
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern Thread CurrentThread_internal();
/// <summary>Gets the currently running thread.</summary>
/// <returns>A <see cref="T:System.Threading.Thread" /> that is the representation of the currently running thread.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B0E RID: 2830
// (get) Token: 0x06003944 RID: 14660 RVA: 0x000C5860 File Offset: 0x000C3A60
public static Thread CurrentThread
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
get
{
return Thread.CurrentThread_internal();
}
}
// Token: 0x17000B0F RID: 2831
// (get) Token: 0x06003945 RID: 14661 RVA: 0x000C5868 File Offset: 0x000C3A68
internal static int CurrentThreadId
{
get
{
return (int)Thread.CurrentThread.thread_id;
}
}
// Token: 0x06003946 RID: 14662 RVA: 0x000C5878 File Offset: 0x000C3A78
private static void InitDataStoreHash()
{
object obj = Thread.datastore_lock;
lock (obj)
{
if (Thread.datastorehash == null)
{
Thread.datastorehash = Hashtable.Synchronized(new Hashtable());
}
}
}
/// <summary>Allocates a named data slot on all threads. For better performance, use fields that are marked with the <see cref="T:System.ThreadStaticAttribute" /> attribute instead.</summary>
/// <returns>A <see cref="T:System.LocalDataStoreSlot" />.</returns>
/// <param name="name">The name of the data slot to be allocated. </param>
/// <exception cref="T:System.ArgumentException">A named data slot with the specified name already exists.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003947 RID: 14663 RVA: 0x000C58D4 File Offset: 0x000C3AD4
public static LocalDataStoreSlot AllocateNamedDataSlot(string name)
{
object obj = Thread.datastore_lock;
LocalDataStoreSlot localDataStoreSlot2;
lock (obj)
{
if (Thread.datastorehash == null)
{
Thread.InitDataStoreHash();
}
LocalDataStoreSlot localDataStoreSlot = (LocalDataStoreSlot)Thread.datastorehash[name];
if (localDataStoreSlot != null)
{
throw new ArgumentException("Named data slot already added");
}
localDataStoreSlot = Thread.AllocateDataSlot();
Thread.datastorehash.Add(name, localDataStoreSlot);
localDataStoreSlot2 = localDataStoreSlot;
}
return localDataStoreSlot2;
}
/// <summary>Eliminates the association between a name and a slot, for all threads in the process. For better performance, use fields that are marked with the <see cref="T:System.ThreadStaticAttribute" /> attribute instead.</summary>
/// <param name="name">The name of the data slot to be freed. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x06003948 RID: 14664 RVA: 0x000C5960 File Offset: 0x000C3B60
public static void FreeNamedDataSlot(string name)
{
object obj = Thread.datastore_lock;
lock (obj)
{
if (Thread.datastorehash != null)
{
Thread.datastorehash.Remove(name);
}
}
}
/// <summary>Allocates an unnamed data slot on all the threads. For better performance, use fields that are marked with the <see cref="T:System.ThreadStaticAttribute" /> attribute instead.</summary>
/// <returns>A <see cref="T:System.LocalDataStoreSlot" />.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x06003949 RID: 14665 RVA: 0x000C59B8 File Offset: 0x000C3BB8
public static LocalDataStoreSlot AllocateDataSlot()
{
return new LocalDataStoreSlot(true);
}
/// <summary>Retrieves the value from the specified slot on the current thread, within the current thread's current domain. For better performance, use fields that are marked with the <see cref="T:System.ThreadStaticAttribute" /> attribute instead.</summary>
/// <returns>The retrieved value.</returns>
/// <param name="slot">The <see cref="T:System.LocalDataStoreSlot" /> from which to get the value. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x0600394A RID: 14666 RVA: 0x000C59C0 File Offset: 0x000C3BC0
public static object GetData(LocalDataStoreSlot slot)
{
object[] array = Thread.local_slots;
if (slot == null)
{
throw new ArgumentNullException("slot");
}
if (array != null && slot.slot < array.Length)
{
return array[slot.slot];
}
return null;
}
/// <summary>Sets the data in the specified slot on the currently running thread, for that thread's current domain. For better performance, use fields marked with the <see cref="T:System.ThreadStaticAttribute" /> attribute instead.</summary>
/// <param name="slot">The <see cref="T:System.LocalDataStoreSlot" /> in which to set the value. </param>
/// <param name="data">The value to be set. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600394B RID: 14667 RVA: 0x000C5A04 File Offset: 0x000C3C04
public static void SetData(LocalDataStoreSlot slot, object data)
{
object[] array = Thread.local_slots;
if (slot == null)
{
throw new ArgumentNullException("slot");
}
if (array == null)
{
array = new object[slot.slot + 2];
Thread.local_slots = array;
}
else if (slot.slot >= array.Length)
{
object[] array2 = new object[slot.slot + 2];
array.CopyTo(array2, 0);
array = array2;
Thread.local_slots = array;
}
array[slot.slot] = data;
}
// Token: 0x0600394C RID: 14668
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void FreeLocalSlotValues(int slot, bool thread_local);
/// <summary>Looks up a named data slot. For better performance, use fields that are marked with the <see cref="T:System.ThreadStaticAttribute" /> attribute instead.</summary>
/// <returns>A <see cref="T:System.LocalDataStoreSlot" /> allocated for this thread.</returns>
/// <param name="name">The name of the local data slot. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x0600394D RID: 14669 RVA: 0x000C5A7C File Offset: 0x000C3C7C
public static LocalDataStoreSlot GetNamedDataSlot(string name)
{
object obj = Thread.datastore_lock;
LocalDataStoreSlot localDataStoreSlot2;
lock (obj)
{
if (Thread.datastorehash == null)
{
Thread.InitDataStoreHash();
}
LocalDataStoreSlot localDataStoreSlot = (LocalDataStoreSlot)Thread.datastorehash[name];
if (localDataStoreSlot == null)
{
localDataStoreSlot = Thread.AllocateNamedDataSlot(name);
}
localDataStoreSlot2 = localDataStoreSlot;
}
return localDataStoreSlot2;
}
/// <summary>Returns the current domain in which the current thread is running.</summary>
/// <returns>An <see cref="T:System.AppDomain" /> representing the current application domain of the running thread.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x0600394E RID: 14670 RVA: 0x000C5AF4 File Offset: 0x000C3CF4
public static AppDomain GetDomain()
{
return AppDomain.CurrentDomain;
}
/// <summary>Returns a unique application domain identifier.</summary>
/// <returns>A 32-bit signed integer uniquely identifying the application domain.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x0600394F RID: 14671
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int GetDomainID();
// Token: 0x06003950 RID: 14672
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void ResetAbort_internal();
/// <summary>Cancels an <see cref="M:System.Threading.Thread.Abort(System.Object)" /> requested for the current thread.</summary>
/// <exception cref="T:System.Threading.ThreadStateException">Abort was not invoked on the current thread. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required security permission for the current thread. </exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x06003951 RID: 14673 RVA: 0x000C5AFC File Offset: 0x000C3CFC
public static void ResetAbort()
{
Thread.ResetAbort_internal();
}
// Token: 0x06003952 RID: 14674
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Sleep_internal(int ms);
/// <summary>Suspends the current thread for a specified time.</summary>
/// <param name="millisecondsTimeout">The number of milliseconds for which the thread is blocked. Specify zero (0) to indicate that this thread should be suspended to allow other waiting threads to execute. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to block the thread indefinitely. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The time-out value is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x06003953 RID: 14675 RVA: 0x000C5B04 File Offset: 0x000C3D04
public static void Sleep(int millisecondsTimeout)
{
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException("millisecondsTimeout", "Negative timeout");
}
Thread.Sleep_internal(millisecondsTimeout);
}
/// <summary>Blocks the current thread for a specified time.</summary>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> set to the amount of time for which the thread is blocked. Specify zero to indicate that this thread should be suspended to allow other waiting threads to execute. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to block the thread indefinitely. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="timeout" /> is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> in milliseconds, or is greater than <see cref="F:System.Int32.MaxValue" /> milliseconds. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x06003954 RID: 14676 RVA: 0x000C5B24 File Offset: 0x000C3D24
public static void Sleep(TimeSpan timeout)
{
long num = (long)timeout.TotalMilliseconds;
if (num < -1L || num > 2147483647L)
{
throw new ArgumentOutOfRangeException("timeout", "timeout out of range");
}
Thread.Sleep_internal((int)num);
}
// Token: 0x06003955 RID: 14677
[MethodImpl(MethodImplOptions.InternalCall)]
private extern IntPtr Thread_internal(MulticastDelegate start);
// Token: 0x06003956 RID: 14678
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Thread_init();
/// <summary>Gets or sets the apartment state of this thread.</summary>
/// <returns>One of the <see cref="T:System.Threading.ApartmentState" /> values. The initial value is Unknown.</returns>
/// <exception cref="T:System.ArgumentException">An attempt is made to set this property to a state that is not a valid apartment state (a state other than single-threaded apartment (STA) or multithreaded apartment (MTA)). </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B10 RID: 2832
// (get) Token: 0x06003957 RID: 14679 RVA: 0x000C5B68 File Offset: 0x000C3D68
// (set) Token: 0x06003958 RID: 14680 RVA: 0x000C5B8C File Offset: 0x000C3D8C
[Obsolete("Deprecated in favor of GetApartmentState, SetApartmentState and TrySetApartmentState.")]
public ApartmentState ApartmentState
{
get
{
if ((this.ThreadState & ThreadState.Stopped) != ThreadState.Running)
{
throw new ThreadStateException("Thread is dead; state can not be accessed.");
}
return (ApartmentState)this.apartment_state;
}
set
{
this.TrySetApartmentState(value);
}
}
// Token: 0x06003959 RID: 14681
[MethodImpl(MethodImplOptions.InternalCall)]
private extern CultureInfo GetCachedCurrentCulture();
// Token: 0x0600395A RID: 14682
[MethodImpl(MethodImplOptions.InternalCall)]
private extern byte[] GetSerializedCurrentCulture();
// Token: 0x0600395B RID: 14683
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetCachedCurrentCulture(CultureInfo culture);
// Token: 0x0600395C RID: 14684
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetSerializedCurrentCulture(byte[] culture);
// Token: 0x0600395D RID: 14685
[MethodImpl(MethodImplOptions.InternalCall)]
private extern CultureInfo GetCachedCurrentUICulture();
// Token: 0x0600395E RID: 14686
[MethodImpl(MethodImplOptions.InternalCall)]
private extern byte[] GetSerializedCurrentUICulture();
// Token: 0x0600395F RID: 14687
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetCachedCurrentUICulture(CultureInfo culture);
// Token: 0x06003960 RID: 14688
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetSerializedCurrentUICulture(byte[] culture);
/// <summary>Gets or sets the culture for the current thread.</summary>
/// <returns>A <see cref="T:System.Globalization.CultureInfo" /> representing the culture for the current thread.</returns>
/// <exception cref="T:System.NotSupportedException">The property is set to a neutral culture. Neutral cultures cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.</exception>
/// <exception cref="T:System.ArgumentNullException">The property is set to null.</exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x17000B11 RID: 2833
// (get) Token: 0x06003961 RID: 14689 RVA: 0x000C5B98 File Offset: 0x000C3D98
// (set) Token: 0x06003962 RID: 14690 RVA: 0x000C5C88 File Offset: 0x000C3E88
public CultureInfo CurrentCulture
{
get
{
if (this.in_currentculture)
{
return CultureInfo.InvariantCulture;
}
CultureInfo cultureInfo = this.GetCachedCurrentCulture();
if (cultureInfo != null)
{
return cultureInfo;
}
byte[] serializedCurrentCulture = this.GetSerializedCurrentCulture();
if (serializedCurrentCulture == null)
{
object obj = Thread.culture_lock;
lock (obj)
{
this.in_currentculture = true;
cultureInfo = CultureInfo.ConstructCurrentCulture();
this.SetCachedCurrentCulture(cultureInfo);
this.in_currentculture = false;
NumberFormatter.SetThreadCurrentCulture(cultureInfo);
return cultureInfo;
}
}
this.in_currentculture = true;
try
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream memoryStream = new MemoryStream(serializedCurrentCulture);
cultureInfo = (CultureInfo)binaryFormatter.Deserialize(memoryStream);
this.SetCachedCurrentCulture(cultureInfo);
}
finally
{
this.in_currentculture = false;
}
NumberFormatter.SetThreadCurrentCulture(cultureInfo);
return cultureInfo;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
CultureInfo cachedCurrentCulture = this.GetCachedCurrentCulture();
if (cachedCurrentCulture == value)
{
return;
}
value.CheckNeutral();
this.in_currentculture = true;
try
{
this.SetCachedCurrentCulture(value);
byte[] array;
if (value.IsReadOnly && value.cached_serialized_form != null)
{
array = value.cached_serialized_form;
}
else
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream memoryStream = new MemoryStream();
binaryFormatter.Serialize(memoryStream, value);
array = memoryStream.GetBuffer();
if (value.IsReadOnly)
{
value.cached_serialized_form = array;
}
}
this.SetSerializedCurrentCulture(array);
}
finally
{
this.in_currentculture = false;
}
NumberFormatter.SetThreadCurrentCulture(value);
}
}
/// <summary>Gets or sets the current culture used by the Resource Manager to look up culture-specific resources at run time.</summary>
/// <returns>A <see cref="T:System.Globalization.CultureInfo" /> representing the current culture.</returns>
/// <exception cref="T:System.ArgumentNullException">The property is set to null. </exception>
/// <exception cref="T:System.ArgumentException">The property is set to a culture name that cannot be used to locate a resource file. Resource filenames must include only letters, numbers, hyphens or underscores.</exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x17000B12 RID: 2834
// (get) Token: 0x06003963 RID: 14691 RVA: 0x000C5D50 File Offset: 0x000C3F50
// (set) Token: 0x06003964 RID: 14692 RVA: 0x000C5E34 File Offset: 0x000C4034
public CultureInfo CurrentUICulture
{
get
{
if (this.in_currentculture)
{
return CultureInfo.InvariantCulture;
}
CultureInfo cultureInfo = this.GetCachedCurrentUICulture();
if (cultureInfo != null)
{
return cultureInfo;
}
byte[] serializedCurrentUICulture = this.GetSerializedCurrentUICulture();
if (serializedCurrentUICulture == null)
{
object obj = Thread.culture_lock;
lock (obj)
{
this.in_currentculture = true;
cultureInfo = CultureInfo.ConstructCurrentUICulture();
this.SetCachedCurrentUICulture(cultureInfo);
this.in_currentculture = false;
return cultureInfo;
}
}
this.in_currentculture = true;
try
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream memoryStream = new MemoryStream(serializedCurrentUICulture);
cultureInfo = (CultureInfo)binaryFormatter.Deserialize(memoryStream);
this.SetCachedCurrentUICulture(cultureInfo);
}
finally
{
this.in_currentculture = false;
}
return cultureInfo;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
CultureInfo cachedCurrentUICulture = this.GetCachedCurrentUICulture();
if (cachedCurrentUICulture == value)
{
return;
}
this.in_currentculture = true;
try
{
this.SetCachedCurrentUICulture(value);
byte[] array;
if (value.IsReadOnly && value.cached_serialized_form != null)
{
array = value.cached_serialized_form;
}
else
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream memoryStream = new MemoryStream();
binaryFormatter.Serialize(memoryStream, value);
array = memoryStream.GetBuffer();
if (value.IsReadOnly)
{
value.cached_serialized_form = array;
}
}
this.SetSerializedCurrentUICulture(array);
}
finally
{
this.in_currentculture = false;
}
}
}
/// <summary>Gets a value indicating whether or not a thread belongs to the managed thread pool.</summary>
/// <returns>true if this thread belongs to the managed thread pool; otherwise, false.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B13 RID: 2835
// (get) Token: 0x06003965 RID: 14693 RVA: 0x000C5EF0 File Offset: 0x000C40F0
public bool IsThreadPoolThread
{
get
{
return this.IsThreadPoolThreadInternal;
}
}
// Token: 0x17000B14 RID: 2836
// (get) Token: 0x06003966 RID: 14694 RVA: 0x000C5EF8 File Offset: 0x000C40F8
// (set) Token: 0x06003967 RID: 14695 RVA: 0x000C5F00 File Offset: 0x000C4100
internal bool IsThreadPoolThreadInternal
{
get
{
return this.threadpool_thread;
}
set
{
this.threadpool_thread = value;
}
}
/// <summary>Gets a value indicating the execution status of the current thread.</summary>
/// <returns>true if this thread has been started and has not terminated normally or aborted; otherwise, false.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B15 RID: 2837
// (get) Token: 0x06003968 RID: 14696 RVA: 0x000C5F0C File Offset: 0x000C410C
public bool IsAlive
{
get
{
ThreadState threadState = this.GetState();
return (threadState & ThreadState.Aborted) == ThreadState.Running && (threadState & ThreadState.Stopped) == ThreadState.Running && (threadState & ThreadState.Unstarted) == ThreadState.Running;
}
}
/// <summary>Gets or sets a value indicating whether or not a thread is a background thread.</summary>
/// <returns>true if this thread is or is to become a background thread; otherwise, false.</returns>
/// <exception cref="T:System.Threading.ThreadStateException">The thread is dead. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B16 RID: 2838
// (get) Token: 0x06003969 RID: 14697 RVA: 0x000C5F40 File Offset: 0x000C4140
// (set) Token: 0x0600396A RID: 14698 RVA: 0x000C5F74 File Offset: 0x000C4174
public bool IsBackground
{
get
{
ThreadState threadState = this.GetState();
if ((threadState & ThreadState.Stopped) != ThreadState.Running)
{
throw new ThreadStateException("Thread is dead; state can not be accessed.");
}
return (threadState & ThreadState.Background) != ThreadState.Running;
}
set
{
if (value)
{
this.SetState(ThreadState.Background);
}
else
{
this.ClrState(ThreadState.Background);
}
}
}
// Token: 0x0600396B RID: 14699
[MethodImpl(MethodImplOptions.InternalCall)]
private extern string GetName_internal();
// Token: 0x0600396C RID: 14700
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetName_internal(string name);
/// <summary>Gets or sets the name of the thread.</summary>
/// <returns>A string containing the name of the thread, or null if no name was set.</returns>
/// <exception cref="T:System.InvalidOperationException">A set operation was requested, and the Name property has already been set. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B17 RID: 2839
// (get) Token: 0x0600396D RID: 14701 RVA: 0x000C5F90 File Offset: 0x000C4190
// (set) Token: 0x0600396E RID: 14702 RVA: 0x000C5F98 File Offset: 0x000C4198
public string Name
{
get
{
return this.GetName_internal();
}
set
{
this.SetName_internal(value);
}
}
/// <summary>Gets or sets a value indicating the scheduling priority of a thread.</summary>
/// <returns>One of the <see cref="T:System.Threading.ThreadPriority" /> values. The default value is Normal.</returns>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has reached a final state, such as <see cref="F:System.Threading.ThreadState.Aborted" />. </exception>
/// <exception cref="T:System.ArgumentException">The value specified for a set operation is not a valid ThreadPriority value. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B18 RID: 2840
// (get) Token: 0x0600396F RID: 14703 RVA: 0x000C5FA4 File Offset: 0x000C41A4
// (set) Token: 0x06003970 RID: 14704 RVA: 0x000C5FA8 File Offset: 0x000C41A8
public ThreadPriority Priority
{
get
{
return ThreadPriority.Lowest;
}
set
{
}
}
/// <summary>Gets a value containing the states of the current thread.</summary>
/// <returns>One of the <see cref="T:System.Threading.ThreadState" /> values indicating the state of the current thread. The initial value is Unstarted.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B19 RID: 2841
// (get) Token: 0x06003971 RID: 14705 RVA: 0x000C5FAC File Offset: 0x000C41AC
public ThreadState ThreadState
{
get
{
return this.GetState();
}
}
// Token: 0x06003972 RID: 14706
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Abort_internal(object stateInfo);
/// <summary>Raises a <see cref="T:System.Threading.ThreadAbortException" /> in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread.</summary>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <exception cref="T:System.Threading.ThreadStateException">The thread that is being aborted is currently suspended.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x06003973 RID: 14707 RVA: 0x000C5FB4 File Offset: 0x000C41B4
public void Abort()
{
this.Abort_internal(null);
}
/// <summary>Raises a <see cref="T:System.Threading.ThreadAbortException" /> in the thread on which it is invoked, to begin the process of terminating the thread while also providing exception information about the thread termination. Calling this method usually terminates the thread.</summary>
/// <param name="stateInfo">An object that contains application-specific information, such as state, which can be used by the thread being aborted. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <exception cref="T:System.Threading.ThreadStateException">The thread that is being aborted is currently suspended.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x06003974 RID: 14708 RVA: 0x000C5FC0 File Offset: 0x000C41C0
public void Abort(object stateInfo)
{
this.Abort_internal(stateInfo);
}
// Token: 0x06003975 RID: 14709
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern object GetAbortExceptionState();
// Token: 0x06003976 RID: 14710
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Interrupt_internal();
/// <summary>Interrupts a thread that is in the WaitSleepJoin thread state.</summary>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the appropriate <see cref="T:System.Security.Permissions.SecurityPermission" />. </exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x06003977 RID: 14711 RVA: 0x000C5FCC File Offset: 0x000C41CC
public void Interrupt()
{
this.Interrupt_internal();
}
// Token: 0x06003978 RID: 14712
[MethodImpl(MethodImplOptions.InternalCall)]
private extern bool Join_internal(int ms, IntPtr handle);
/// <summary>Blocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping.</summary>
/// <exception cref="T:System.Threading.ThreadStateException">The caller attempted to join a thread that is in the <see cref="F:System.Threading.ThreadState.Unstarted" /> state. </exception>
/// <exception cref="T:System.Threading.ThreadInterruptedException">The thread is interrupted while waiting. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x06003979 RID: 14713 RVA: 0x000C5FD4 File Offset: 0x000C41D4
public void Join()
{
this.Join_internal(-1, this.system_thread_handle);
}
/// <summary>Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping.</summary>
/// <returns>true if the thread has terminated; false if the thread has not terminated after the amount of time specified by the <paramref name="millisecondsTimeout" /> parameter has elapsed.</returns>
/// <param name="millisecondsTimeout">The number of milliseconds to wait for the thread to terminate. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="millisecondsTimeout" /> is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> in milliseconds. </exception>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has not been started. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x0600397A RID: 14714 RVA: 0x000C5FE4 File Offset: 0x000C41E4
public bool Join(int millisecondsTimeout)
{
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException("millisecondsTimeout", "Timeout less than zero");
}
return this.Join_internal(millisecondsTimeout, this.system_thread_handle);
}
/// <summary>Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping.</summary>
/// <returns>true if the thread terminated; false if the thread has not terminated after the amount of time specified by the <paramref name="timeout" /> parameter has elapsed.</returns>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> set to the amount of time to wait for the thread to terminate. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="timeout" /> is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> in milliseconds, or is greater than <see cref="F:System.Int32.MaxValue" /> milliseconds. </exception>
/// <exception cref="T:System.Threading.ThreadStateException">The caller attempted to join a thread that is in the <see cref="F:System.Threading.ThreadState.Unstarted" /> state. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x0600397B RID: 14715 RVA: 0x000C6018 File Offset: 0x000C4218
public bool Join(TimeSpan timeout)
{
long num = (long)timeout.TotalMilliseconds;
if (num < -1L || num > 2147483647L)
{
throw new ArgumentOutOfRangeException("timeout", "timeout out of range");
}
return this.Join_internal((int)num, this.system_thread_handle);
}
/// <summary>Synchronizes memory access as follows: The processor executing the current thread cannot reorder instructions in such a way that memory accesses prior to the call to <see cref="M:System.Threading.Thread.MemoryBarrier" /> execute after memory accesses that follow the call to <see cref="M:System.Threading.Thread.MemoryBarrier" />.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0600397C RID: 14716
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void MemoryBarrier();
// Token: 0x0600397D RID: 14717
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Resume_internal();
/// <summary>Resumes a thread that has been suspended.</summary>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has not been started, is dead, or is not in the suspended state. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the appropriate <see cref="T:System.Security.Permissions.SecurityPermission" />. </exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x0600397E RID: 14718 RVA: 0x000C6060 File Offset: 0x000C4260
[Obsolete("")]
public void Resume()
{
this.Resume_internal();
}
// Token: 0x0600397F RID: 14719
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void SpinWait_nop();
/// <summary>Causes a thread to wait the number of times defined by the <paramref name="iterations" /> parameter.</summary>
/// <param name="iterations">A 32-bit signed integer that defines how long a thread is to wait. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003980 RID: 14720 RVA: 0x000C6068 File Offset: 0x000C4268
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static void SpinWait(int iterations)
{
if (iterations < 0)
{
return;
}
while (iterations-- > 0)
{
Thread.SpinWait_nop();
}
}
/// <summary>Causes the operating system to change the state of the current instance to <see cref="F:System.Threading.ThreadState.Running" />.</summary>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has already been started. </exception>
/// <exception cref="T:System.OutOfMemoryException">There is not enough memory available to start this thread. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x06003981 RID: 14721 RVA: 0x000C6088 File Offset: 0x000C4288
public void Start()
{
if (!ExecutionContext.IsFlowSuppressed())
{
this.ec_to_set = ExecutionContext.Capture();
}
if (Thread.CurrentThread._principal != null)
{
this._principal = Thread.CurrentThread._principal;
}
if (this.Thread_internal(this.threadstart) == (IntPtr)0)
{
throw new SystemException("Thread creation failed.");
}
}
// Token: 0x06003982 RID: 14722
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Suspend_internal();
/// <summary>Either suspends the thread, or if the thread is already suspended, has no effect.</summary>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has not been started or is dead. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the appropriate <see cref="T:System.Security.Permissions.SecurityPermission" />. </exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x06003983 RID: 14723 RVA: 0x000C60F0 File Offset: 0x000C42F0
[Obsolete("")]
public void Suspend()
{
this.Suspend_internal();
}
// Token: 0x06003984 RID: 14724
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Thread_free_internal(IntPtr handle);
// Token: 0x06003985 RID: 14725 RVA: 0x000C60F8 File Offset: 0x000C42F8
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
~Thread()
{
this.Thread_free_internal(this.system_thread_handle);
}
// Token: 0x06003986 RID: 14726
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetState(ThreadState set);
// Token: 0x06003987 RID: 14727
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void ClrState(ThreadState clr);
// Token: 0x06003988 RID: 14728
[MethodImpl(MethodImplOptions.InternalCall)]
private extern ThreadState GetState();
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003989 RID: 14729
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern byte VolatileRead(ref byte address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600398A RID: 14730
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double VolatileRead(ref double address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600398B RID: 14731
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern short VolatileRead(ref short address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600398C RID: 14732
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int VolatileRead(ref int address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600398D RID: 14733
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern long VolatileRead(ref long address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600398E RID: 14734
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern IntPtr VolatileRead(ref IntPtr address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600398F RID: 14735
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern object VolatileRead(ref object address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003990 RID: 14736
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern sbyte VolatileRead(ref sbyte address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003991 RID: 14737
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float VolatileRead(ref float address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003992 RID: 14738
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern ushort VolatileRead(ref ushort address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003993 RID: 14739
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern uint VolatileRead(ref uint address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003994 RID: 14740
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern ulong VolatileRead(ref ulong address);
/// <summary>Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.</summary>
/// <returns>The latest value written to the field by any processor.</returns>
/// <param name="address">The field to be read. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003995 RID: 14741
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern UIntPtr VolatileRead(ref UIntPtr address);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003996 RID: 14742
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref byte address, byte value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003997 RID: 14743
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref double address, double value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003998 RID: 14744
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref short address, short value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06003999 RID: 14745
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref int address, int value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600399A RID: 14746
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref long address, long value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600399B RID: 14747
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref IntPtr address, IntPtr value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600399C RID: 14748
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref object address, object value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600399D RID: 14749
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref sbyte address, sbyte value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600399E RID: 14750
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref float address, float value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x0600399F RID: 14751
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref ushort address, ushort value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x060039A0 RID: 14752
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref uint address, uint value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x060039A1 RID: 14753
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref ulong address, ulong value);
/// <summary>Writes a value to a field immediately, so that the value is visible to all processors in the computer.</summary>
/// <param name="address">The field to which the value is to be written. </param>
/// <param name="value">The value to be written. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x060039A2 RID: 14754
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void VolatileWrite(ref UIntPtr address, UIntPtr value);
// Token: 0x060039A3 RID: 14755 RVA: 0x000C613C File Offset: 0x000C433C
private static int GetNewManagedId()
{
return Thread.GetNewManagedId_internal();
}
// Token: 0x060039A4 RID: 14756
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int GetNewManagedId_internal();
/// <summary>Gets an <see cref="T:System.Threading.ExecutionContext" /> object that contains information about the various contexts of the current thread. </summary>
/// <returns>An <see cref="T:System.Threading.ExecutionContext" /> object that consolidates context information for the current thread.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B1A RID: 2842
// (get) Token: 0x060039A5 RID: 14757 RVA: 0x000C6144 File Offset: 0x000C4344
[MonoTODO("limited to CompressedStack support")]
public ExecutionContext ExecutionContext
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
get
{
if (Thread._ec == null)
{
Thread._ec = new ExecutionContext();
}
return Thread._ec;
}
}
/// <summary>Gets a unique identifier for the current managed thread.</summary>
/// <returns>An integer that represents a unique identifier for this managed thread.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B1B RID: 2843
// (get) Token: 0x060039A6 RID: 14758 RVA: 0x000C6160 File Offset: 0x000C4360
public int ManagedThreadId
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
get
{
if (this.managed_id == 0)
{
int newManagedId = Thread.GetNewManagedId();
Interlocked.CompareExchange(ref this.managed_id, newManagedId, 0);
}
return this.managed_id;
}
}
/// <summary>Notifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception might jeopardize other tasks in the application domain.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x060039A7 RID: 14759 RVA: 0x000C6194 File Offset: 0x000C4394
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static void BeginCriticalRegion()
{
Thread.CurrentThread.critical_region_level++;
}
/// <summary>Notifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception are limited to the current task.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x060039A8 RID: 14760 RVA: 0x000C61AC File Offset: 0x000C43AC
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static void EndCriticalRegion()
{
Thread.CurrentThread.critical_region_level--;
}
/// <summary>Notifies a host that managed code is about to execute instructions that depend on the identity of the current physical operating system thread.</summary>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x060039A9 RID: 14761 RVA: 0x000C61C4 File Offset: 0x000C43C4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static void BeginThreadAffinity()
{
}
/// <summary>Notifies a host that managed code has finished executing instructions that depend on the identity of the current physical operating system thread.</summary>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x060039AA RID: 14762 RVA: 0x000C61C8 File Offset: 0x000C43C8
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static void EndThreadAffinity()
{
}
/// <summary>Returns an <see cref="T:System.Threading.ApartmentState" /> value indicating the apartment state.</summary>
/// <returns>One of the <see cref="T:System.Threading.ApartmentState" /> values indicating the apartment state of the managed thread. The default is <see cref="F:System.Threading.ApartmentState.Unknown" />.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x060039AB RID: 14763 RVA: 0x000C61CC File Offset: 0x000C43CC
public ApartmentState GetApartmentState()
{
return (ApartmentState)this.apartment_state;
}
/// <summary>Sets the apartment state of a thread before it is started.</summary>
/// <param name="state">The new apartment state.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="state" /> is not a valid apartment state.</exception>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has already been started.</exception>
/// <exception cref="T:System.InvalidOperationException">The apartment state has already been initialized.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039AC RID: 14764 RVA: 0x000C61D4 File Offset: 0x000C43D4
public void SetApartmentState(ApartmentState state)
{
if (!this.TrySetApartmentState(state))
{
throw new InvalidOperationException("Failed to set the specified COM apartment state.");
}
}
/// <summary>Sets the apartment state of a thread before it is started.</summary>
/// <returns>true if the apartment state is set; otherwise, false.</returns>
/// <param name="state">The new apartment state.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="state" /> is not a valid apartment state.</exception>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has already been started.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039AD RID: 14765 RVA: 0x000C61F0 File Offset: 0x000C43F0
public bool TrySetApartmentState(ApartmentState state)
{
if (this != Thread.CurrentThread && (this.ThreadState & ThreadState.Unstarted) == ThreadState.Running)
{
throw new ThreadStateException("Thread was in an invalid state for the operation being executed.");
}
if (this.apartment_state != 2)
{
return false;
}
this.apartment_state = (byte)state;
return true;
}
/// <summary>Returns a hash code for the current thread.</summary>
/// <returns>An integer hash code value.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x060039AE RID: 14766 RVA: 0x000C6238 File Offset: 0x000C4438
[ComVisible(false)]
public override int GetHashCode()
{
return this.ManagedThreadId;
}
/// <summary>Causes the operating system to change the state of the current instance to <see cref="F:System.Threading.ThreadState.Running" />, and optionally supplies an object containing data to be used by the method the thread executes.</summary>
/// <param name="parameter">An object that contains data to be used by the method the thread executes.</param>
/// <exception cref="T:System.Threading.ThreadStateException">The thread has already been started. </exception>
/// <exception cref="T:System.OutOfMemoryException">There is not enough memory available to start this thread. </exception>
/// <exception cref="T:System.InvalidOperationException">This thread was created using a <see cref="T:System.Threading.ThreadStart" /> delegate instead of a <see cref="T:System.Threading.ParameterizedThreadStart" /> delegate.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039AF RID: 14767 RVA: 0x000C6240 File Offset: 0x000C4440
public void Start(object parameter)
{
this.start_obj = parameter;
this.Start();
}
/// <summary>Returns a <see cref="T:System.Threading.CompressedStack" /> object that can be used to capture the stack for the current thread.</summary>
/// <returns>A <see cref="T:System.Threading.CompressedStack" /> object that can be used to capture the stack for the current thread.</returns>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="00000000000000000400000000000000" />
/// </PermissionSet>
// Token: 0x060039B0 RID: 14768 RVA: 0x000C6250 File Offset: 0x000C4450
[Obsolete("see CompressedStack class")]
public CompressedStack GetCompressedStack()
{
CompressedStack compressedStack = this.ExecutionContext.SecurityContext.CompressedStack;
return (compressedStack != null && !compressedStack.IsEmpty()) ? compressedStack.CreateCopy() : null;
}
/// <summary>Applies a captured <see cref="T:System.Threading.CompressedStack" /> to the current thread.</summary>
/// <param name="stack">The <see cref="T:System.Threading.CompressedStack" /> object to be applied to the current thread.</param>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="00000000000000000400000000000000" />
/// </PermissionSet>
// Token: 0x060039B1 RID: 14769 RVA: 0x000C628C File Offset: 0x000C448C
[Obsolete("see CompressedStack class")]
public void SetCompressedStack(CompressedStack stack)
{
this.ExecutionContext.SecurityContext.CompressedStack = stack;
}
// Token: 0x0400170E RID: 5902
private int lock_thread_id;
// Token: 0x0400170F RID: 5903
private IntPtr system_thread_handle;
// Token: 0x04001710 RID: 5904
private object cached_culture_info;
// Token: 0x04001711 RID: 5905
private IntPtr unused0;
// Token: 0x04001712 RID: 5906
private bool threadpool_thread;
// Token: 0x04001713 RID: 5907
private IntPtr name;
// Token: 0x04001714 RID: 5908
private int name_len;
// Token: 0x04001715 RID: 5909
private ThreadState state = ThreadState.Unstarted;
// Token: 0x04001716 RID: 5910
private object abort_exc;
// Token: 0x04001717 RID: 5911
private int abort_state_handle;
// Token: 0x04001718 RID: 5912
private long thread_id;
// Token: 0x04001719 RID: 5913
private IntPtr start_notify;
// Token: 0x0400171A RID: 5914
private IntPtr stack_ptr;
// Token: 0x0400171B RID: 5915
private UIntPtr static_data;
// Token: 0x0400171C RID: 5916
private IntPtr jit_data;
// Token: 0x0400171D RID: 5917
private IntPtr lock_data;
// Token: 0x0400171E RID: 5918
private object current_appcontext;
// Token: 0x0400171F RID: 5919
private int stack_size;
// Token: 0x04001720 RID: 5920
private object start_obj;
// Token: 0x04001721 RID: 5921
private IntPtr appdomain_refs;
// Token: 0x04001722 RID: 5922
private int interruption_requested;
// Token: 0x04001723 RID: 5923
private IntPtr suspend_event;
// Token: 0x04001724 RID: 5924
private IntPtr suspended_event;
// Token: 0x04001725 RID: 5925
private IntPtr resume_event;
// Token: 0x04001726 RID: 5926
private IntPtr synch_cs;
// Token: 0x04001727 RID: 5927
private IntPtr serialized_culture_info;
// Token: 0x04001728 RID: 5928
private int serialized_culture_info_len;
// Token: 0x04001729 RID: 5929
private IntPtr serialized_ui_culture_info;
// Token: 0x0400172A RID: 5930
private int serialized_ui_culture_info_len;
// Token: 0x0400172B RID: 5931
private bool thread_dump_requested;
// Token: 0x0400172C RID: 5932
private IntPtr end_stack;
// Token: 0x0400172D RID: 5933
private bool thread_interrupt_requested;
// Token: 0x0400172E RID: 5934
private byte apartment_state;
// Token: 0x0400172F RID: 5935
private volatile int critical_region_level;
// Token: 0x04001730 RID: 5936
private int small_id;
// Token: 0x04001731 RID: 5937
private IntPtr manage_callback;
// Token: 0x04001732 RID: 5938
private object pending_exception;
// Token: 0x04001733 RID: 5939
private ExecutionContext ec_to_set;
// Token: 0x04001734 RID: 5940
private IntPtr interrupt_on_stop;
// Token: 0x04001735 RID: 5941
private IntPtr unused3;
// Token: 0x04001736 RID: 5942
private IntPtr unused4;
// Token: 0x04001737 RID: 5943
private IntPtr unused5;
// Token: 0x04001738 RID: 5944
private IntPtr unused6;
// Token: 0x04001739 RID: 5945
[ThreadStatic]
private static object[] local_slots;
// Token: 0x0400173A RID: 5946
[ThreadStatic]
private static ExecutionContext _ec;
// Token: 0x0400173B RID: 5947
private MulticastDelegate threadstart;
// Token: 0x0400173C RID: 5948
private int managed_id;
// Token: 0x0400173D RID: 5949
private IPrincipal _principal;
// Token: 0x0400173E RID: 5950
private static Hashtable datastorehash;
// Token: 0x0400173F RID: 5951
private static object datastore_lock = new object();
// Token: 0x04001740 RID: 5952
private bool in_currentculture;
// Token: 0x04001741 RID: 5953
private static object culture_lock = new object();
}
}
@@ -0,0 +1,27 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading
{
/// <summary>The exception that is thrown when a call is made to the <see cref="M:System.Threading.Thread.Abort(System.Object)" /> method. This class cannot be inherited.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200061F RID: 1567
[ComVisible(true)]
[Serializable]
public sealed class ThreadAbortException : SystemException
{
// Token: 0x060039B2 RID: 14770 RVA: 0x000C62A0 File Offset: 0x000C44A0
private ThreadAbortException()
: base("Thread was being aborted")
{
base.HResult = -2146233040;
}
// Token: 0x060039B3 RID: 14771 RVA: 0x000C62B8 File Offset: 0x000C44B8
private ThreadAbortException(SerializationInfo info, StreamingContext sc)
: base(info, sc)
{
}
}
}
@@ -0,0 +1,47 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading
{
/// <summary>The exception that is thrown when a <see cref="T:System.Threading.Thread" /> is interrupted while it is in a waiting state.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000620 RID: 1568
[ComVisible(true)]
[Serializable]
public class ThreadInterruptedException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadInterruptedException" /> class with default properties.</summary>
// Token: 0x060039B4 RID: 14772 RVA: 0x000C62C4 File Offset: 0x000C44C4
public ThreadInterruptedException()
: base("Thread interrupted")
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadInterruptedException" /> class with a specified error message.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
// Token: 0x060039B5 RID: 14773 RVA: 0x000C62D4 File Offset: 0x000C44D4
public ThreadInterruptedException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadInterruptedException" /> class with serialized data.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
// Token: 0x060039B6 RID: 14774 RVA: 0x000C62E0 File Offset: 0x000C44E0
protected ThreadInterruptedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadInterruptedException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
// Token: 0x060039B7 RID: 14775 RVA: 0x000C62EC File Offset: 0x000C44EC
public ThreadInterruptedException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}
+185
View File
@@ -0,0 +1,185 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Provides a pool of threads that can be used to post work items, process asynchronous I/O, wait on behalf of other threads, and process timers.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000621 RID: 1569
public static class ThreadPool
{
/// <summary>Binds an operating system handle to the <see cref="T:System.Threading.ThreadPool" />.</summary>
/// <returns>true if the handle is bound; otherwise, false.</returns>
/// <param name="osHandle">An <see cref="T:System.IntPtr" /> that holds the handle. The handle must have been opened for overlapped I/O on the unmanaged side. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039B8 RID: 14776 RVA: 0x000C62F8 File Offset: 0x000C44F8
[Obsolete("This method is obsolete, use BindHandle(SafeHandle) instead")]
public static bool BindHandle(IntPtr osHandle)
{
return true;
}
/// <summary>Binds an operating system handle to the <see cref="T:System.Threading.ThreadPool" />.</summary>
/// <returns>true if the handle is bound; otherwise, false.</returns>
/// <param name="osHandle">A <see cref="T:System.Runtime.InteropServices.SafeHandle" /> that holds the operating system handle. The handle must have been opened for overlapped I/O on the unmanaged side.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="osHandle" /> is null. </exception>
// Token: 0x060039B9 RID: 14777 RVA: 0x000C62FC File Offset: 0x000C44FC
public static bool BindHandle(SafeHandle osHandle)
{
if (osHandle == null)
{
throw new ArgumentNullException("osHandle");
}
return true;
}
/// <summary>Retrieves the number of requests to the thread pool that can be active concurrently. All requests above that number remain queued until thread pool threads become available.</summary>
/// <param name="workerThreads">The maximum number of worker threads in the thread pool. </param>
/// <param name="completionPortThreads">The maximum number of asynchronous I/O threads in the thread pool. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x060039BA RID: 14778
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void GetMaxThreads(out int workerThreads, out int completionPortThreads);
/// <summary>Retrieves the number of idle threads the thread pool maintains in anticipation of new requests.</summary>
/// <param name="workerThreads">The minimum number of idle worker threads currently maintained by the thread pool. </param>
/// <param name="completionPortThreads">The minimum number of idle asynchronous I/O threads currently maintained by the thread pool. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x060039BB RID: 14779
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void GetMinThreads(out int workerThreads, out int completionPortThreads);
/// <summary>Sets the number of idle threads the thread pool maintains in anticipation of new requests.</summary>
/// <returns>true if the change is successful; otherwise, false.</returns>
/// <param name="workerThreads">The new minimum number of idle worker threads to be maintained by the thread pool. </param>
/// <param name="completionPortThreads">The new minimum number of idle asynchronous I/O threads to be maintained by the thread pool. </param>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x060039BC RID: 14780
[MonoTODO("The min number of completion port threads is not evaluated.")]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool SetMinThreads(int workerThreads, int completionPortThreads);
/// <summary>Sets the number of requests to the thread pool that can be active concurrently. All requests above that number remain queued until thread pool threads become available.</summary>
/// <returns>true if the change is successful; otherwise, false.</returns>
/// <param name="workerThreads">The maximum number of worker threads in the thread pool. </param>
/// <param name="completionPortThreads">The maximum number of asynchronous I/O threads in the thread pool. </param>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlThread" />
/// </PermissionSet>
// Token: 0x060039BD RID: 14781
[MonoTODO("The max number of threads cannot be decremented.")]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool SetMaxThreads(int workerThreads, int completionPortThreads);
/// <summary>Queues a method for execution. The method executes when a thread pool thread becomes available.</summary>
/// <returns>true if the method is successfully queued; <see cref="T:System.NotSupportedException" /> is thrown if the work item is not queued.</returns>
/// <param name="callBack">A <see cref="T:System.Threading.WaitCallback" /> that represents the method to be executed. </param>
/// <exception cref="T:System.NotSupportedException">The common language runtime (CLR) is hosted, and the host does not support this action.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="callBack" /> is null.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039BE RID: 14782 RVA: 0x000C6310 File Offset: 0x000C4510
public static bool QueueUserWorkItem(WaitCallback callBack)
{
return ThreadPool.QueueUserWorkItem(callBack, null);
}
/// <summary>Queues a method for execution, and specifies an object containing data to be used by the method. The method executes when a thread pool thread becomes available.</summary>
/// <returns>true if the method is successfully queued; <see cref="T:System.NotSupportedException" /> is thrown if the work item could not be queued.</returns>
/// <param name="callBack">A <see cref="T:System.Threading.WaitCallback" /> representing the method to execute. </param>
/// <param name="state">An object containing data to be used by the method. </param>
/// <exception cref="T:System.NotSupportedException">The common language runtime (CLR) is hosted, and the host does not support this action.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="callBack" /> is null.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039BF RID: 14783 RVA: 0x000C631C File Offset: 0x000C451C
public static bool QueueUserWorkItem(WaitCallback callBack, object state)
{
if (callBack == null)
{
throw new ArgumentNullException("callBack");
}
return callBack.BeginInvoke(state, null, null) != null;
}
/// <summary>Registers a delegate to wait for a <see cref="T:System.Threading.WaitHandle" />, specifying a 32-bit signed integer for the time-out in milliseconds.</summary>
/// <returns>The <see cref="T:System.Threading.RegisteredWaitHandle" /> that encapsulates the native handle.</returns>
/// <param name="waitObject">The <see cref="T:System.Threading.WaitHandle" /> to register. Use a <see cref="T:System.Threading.WaitHandle" /> other than <see cref="T:System.Threading.Mutex" />.</param>
/// <param name="callBack">The <see cref="T:System.Threading.WaitOrTimerCallback" /> delegate to call when the <paramref name="waitObject" /> parameter is signaled. </param>
/// <param name="state">The object that is passed to the delegate. </param>
/// <param name="millisecondsTimeOutInterval">The time-out in milliseconds. If the <paramref name="millisecondsTimeOutInterval" /> parameter is 0 (zero), the function tests the object's state and returns immediately. If <paramref name="millisecondsTimeOutInterval" /> is -1, the function's time-out interval never elapses. </param>
/// <param name="executeOnlyOnce">true to indicate that the thread will no longer wait on the <paramref name="waitObject" /> parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="millisecondsTimeOutInterval" /> parameter is less than -1. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039C0 RID: 14784 RVA: 0x000C6350 File Offset: 0x000C4550
public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callBack, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce)
{
return ThreadPool.RegisterWaitForSingleObject(waitObject, callBack, state, (long)millisecondsTimeOutInterval, executeOnlyOnce);
}
/// <summary>Registers a delegate to wait for a <see cref="T:System.Threading.WaitHandle" />, specifying a 64-bit signed integer for the time-out in milliseconds.</summary>
/// <returns>The <see cref="T:System.Threading.RegisteredWaitHandle" /> that encapsulates the native handle.</returns>
/// <param name="waitObject">The <see cref="T:System.Threading.WaitHandle" /> to register. Use a <see cref="T:System.Threading.WaitHandle" /> other than <see cref="T:System.Threading.Mutex" />.</param>
/// <param name="callBack">The <see cref="T:System.Threading.WaitOrTimerCallback" /> delegate to call when the <paramref name="waitObject" /> parameter is signaled. </param>
/// <param name="state">The object passed to the delegate. </param>
/// <param name="millisecondsTimeOutInterval">The time-out in milliseconds. If the <paramref name="millisecondsTimeOutInterval" /> parameter is 0 (zero), the function tests the object's state and returns immediately. If <paramref name="millisecondsTimeOutInterval" /> is -1, the function's time-out interval never elapses. </param>
/// <param name="executeOnlyOnce">true to indicate that the thread will no longer wait on the <paramref name="waitObject" /> parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="millisecondsTimeOutInterval" /> parameter is less than -1. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039C1 RID: 14785 RVA: 0x000C6360 File Offset: 0x000C4560
public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callBack, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce)
{
if (millisecondsTimeOutInterval < -1L)
{
throw new ArgumentOutOfRangeException("timeout", "timeout < -1");
}
if (millisecondsTimeOutInterval > 2147483647L)
{
throw new NotSupportedException("Timeout is too big. Maximum is Int32.MaxValue");
}
TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, (int)millisecondsTimeOutInterval);
RegisteredWaitHandle registeredWaitHandle = new RegisteredWaitHandle(waitObject, callBack, state, timeSpan, executeOnlyOnce);
ThreadPool.QueueUserWorkItem(new WaitCallback(registeredWaitHandle.Wait), null);
return registeredWaitHandle;
}
/// <summary>Registers a delegate to wait for a <see cref="T:System.Threading.WaitHandle" />, specifying a <see cref="T:System.TimeSpan" /> value for the time-out.</summary>
/// <returns>The <see cref="T:System.Threading.RegisteredWaitHandle" /> that encapsulates the native handle.</returns>
/// <param name="waitObject">The <see cref="T:System.Threading.WaitHandle" /> to register. Use a <see cref="T:System.Threading.WaitHandle" /> other than <see cref="T:System.Threading.Mutex" />.</param>
/// <param name="callBack">The <see cref="T:System.Threading.WaitOrTimerCallback" /> delegate to call when the <paramref name="waitObject" /> parameter is signaled. </param>
/// <param name="state">The object passed to the delegate. </param>
/// <param name="timeout">The time-out represented by a <see cref="T:System.TimeSpan" />. If <paramref name="timeout" /> is 0 (zero), the function tests the object's state and returns immediately. If <paramref name="timeout" /> is -1, the function's time-out interval never elapses. </param>
/// <param name="executeOnlyOnce">true to indicate that the thread will no longer wait on the <paramref name="waitObject" /> parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="timeout" /> parameter is less than -1. </exception>
/// <exception cref="T:System.NotSupportedException">The <paramref name="timeout" /> parameter is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039C2 RID: 14786 RVA: 0x000C63CC File Offset: 0x000C45CC
public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callBack, object state, TimeSpan timeout, bool executeOnlyOnce)
{
return ThreadPool.RegisterWaitForSingleObject(waitObject, callBack, state, (long)timeout.TotalMilliseconds, executeOnlyOnce);
}
/// <summary>Registers a delegate to wait for a <see cref="T:System.Threading.WaitHandle" />, specifying a 32-bit unsigned integer for the time-out in milliseconds.</summary>
/// <returns>The <see cref="T:System.Threading.RegisteredWaitHandle" /> that can be used to cancel the registered wait operation.</returns>
/// <param name="waitObject">The <see cref="T:System.Threading.WaitHandle" /> to register. Use a <see cref="T:System.Threading.WaitHandle" /> other than <see cref="T:System.Threading.Mutex" />.</param>
/// <param name="callBack">The <see cref="T:System.Threading.WaitOrTimerCallback" /> delegate to call when the <paramref name="waitObject" /> parameter is signaled. </param>
/// <param name="state">The object passed to the delegate. </param>
/// <param name="millisecondsTimeOutInterval">The time-out in milliseconds. If the <paramref name="millisecondsTimeOutInterval" /> parameter is 0 (zero), the function tests the object's state and returns immediately. If <paramref name="millisecondsTimeOutInterval" /> is -1, the function's time-out interval never elapses. </param>
/// <param name="executeOnlyOnce">true to indicate that the thread will no longer wait on the <paramref name="waitObject" /> parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="millisecondsTimeOutInterval" /> parameter is less than -1. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039C3 RID: 14787 RVA: 0x000C63E0 File Offset: 0x000C45E0
[CLSCompliant(false)]
public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callBack, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce)
{
return ThreadPool.RegisterWaitForSingleObject(waitObject, callBack, state, (long)((ulong)millisecondsTimeOutInterval), executeOnlyOnce);
}
}
}
@@ -0,0 +1,29 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Specifies the scheduling priority of a <see cref="T:System.Threading.Thread" />.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000622 RID: 1570
[ComVisible(true)]
[Serializable]
public enum ThreadPriority
{
/// <summary>The <see cref="T:System.Threading.Thread" /> can be scheduled after threads with any other priority.</summary>
// Token: 0x04001743 RID: 5955
Lowest,
/// <summary>The <see cref="T:System.Threading.Thread" /> can be scheduled after threads with Normal priority and before those with Lowest priority.</summary>
// Token: 0x04001744 RID: 5956
BelowNormal,
/// <summary>The <see cref="T:System.Threading.Thread" /> can be scheduled after threads with AboveNormal priority and before those with BelowNormal priority. Threads have Normal priority by default.</summary>
// Token: 0x04001745 RID: 5957
Normal,
/// <summary>The <see cref="T:System.Threading.Thread" /> can be scheduled after threads with Highest priority and before those with Normal priority.</summary>
// Token: 0x04001746 RID: 5958
AboveNormal,
/// <summary>The <see cref="T:System.Threading.Thread" /> can be scheduled before threads with any other priority.</summary>
// Token: 0x04001747 RID: 5959
Highest
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents the method that executes on a <see cref="T:System.Threading.Thread" />.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x020006E0 RID: 1760
// (Invoke) Token: 0x06004208 RID: 16904
[ComVisible(true)]
public delegate void ThreadStart();
}
@@ -0,0 +1,35 @@
using System;
using System.Runtime.Serialization;
namespace System.Threading
{
/// <summary>The exception that is thrown when a failure occurs in a managed thread after the underlying operating system thread has been started, but before the thread is ready to execute user code.</summary>
// Token: 0x02000623 RID: 1571
[Serializable]
public sealed class ThreadStartException : SystemException
{
// Token: 0x060039C4 RID: 14788 RVA: 0x000C63F0 File Offset: 0x000C45F0
internal ThreadStartException()
: base("Thread Start Error")
{
}
// Token: 0x060039C5 RID: 14789 RVA: 0x000C6400 File Offset: 0x000C4600
internal ThreadStartException(string message)
: base(message)
{
}
// Token: 0x060039C6 RID: 14790 RVA: 0x000C640C File Offset: 0x000C460C
internal ThreadStartException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
// Token: 0x060039C7 RID: 14791 RVA: 0x000C6418 File Offset: 0x000C4618
internal ThreadStartException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Specifies the execution states of a <see cref="T:System.Threading.Thread" />.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000624 RID: 1572
[Flags]
[ComVisible(true)]
[Serializable]
public enum ThreadState
{
/// <summary>The thread has been started, it is not blocked, and there is no pending <see cref="T:System.Threading.ThreadAbortException" />.</summary>
// Token: 0x04001749 RID: 5961
Running = 0,
/// <summary>The thread is being requested to stop. This is for internal use only.</summary>
// Token: 0x0400174A RID: 5962
StopRequested = 1,
/// <summary>The thread is being requested to suspend.</summary>
// Token: 0x0400174B RID: 5963
SuspendRequested = 2,
/// <summary>The thread is being executed as a background thread, as opposed to a foreground thread. This state is controlled by setting the <see cref="P:System.Threading.Thread.IsBackground" /> property.</summary>
// Token: 0x0400174C RID: 5964
Background = 4,
/// <summary>The <see cref="M:System.Threading.Thread.Start" /> method has not been invoked on the thread.</summary>
// Token: 0x0400174D RID: 5965
Unstarted = 8,
/// <summary>The thread has stopped.</summary>
// Token: 0x0400174E RID: 5966
Stopped = 16,
/// <summary>The thread is blocked. This could be the result of calling <see cref="M:System.Threading.Thread.Sleep(System.Int32)" /> or <see cref="M:System.Threading.Thread.Join" />, of requesting a lock — for example, by calling <see cref="M:System.Threading.Monitor.Enter(System.Object)" /> or <see cref="M:System.Threading.Monitor.Wait(System.Object,System.Int32,System.Boolean)" /> — or of waiting on a thread synchronization object such as <see cref="T:System.Threading.ManualResetEvent" />. </summary>
// Token: 0x0400174F RID: 5967
WaitSleepJoin = 32,
/// <summary>The thread has been suspended.</summary>
// Token: 0x04001750 RID: 5968
Suspended = 64,
/// <summary>The <see cref="M:System.Threading.Thread.Abort(System.Object)" /> method has been invoked on the thread, but the thread has not yet received the pending <see cref="T:System.Threading.ThreadAbortException" /> that will attempt to terminate it.</summary>
// Token: 0x04001751 RID: 5969
AbortRequested = 128,
/// <summary>The thread state includes <see cref="F:System.Threading.ThreadState.AbortRequested" /> and the thread is now dead, but its state has not yet changed to <see cref="F:System.Threading.ThreadState.Stopped" />.</summary>
// Token: 0x04001752 RID: 5970
Aborted = 256
}
}
@@ -0,0 +1,47 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading
{
/// <summary>The exception that is thrown when a <see cref="T:System.Threading.Thread" /> is in an invalid <see cref="P:System.Threading.Thread.ThreadState" /> for the method call.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000625 RID: 1573
[ComVisible(true)]
[Serializable]
public class ThreadStateException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadStateException" /> class with default properties.</summary>
// Token: 0x060039C8 RID: 14792 RVA: 0x000C6424 File Offset: 0x000C4624
public ThreadStateException()
: base("Thread State Error")
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadStateException" /> class with a specified error message.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
// Token: 0x060039C9 RID: 14793 RVA: 0x000C6434 File Offset: 0x000C4634
public ThreadStateException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadStateException" /> class with serialized data.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
// Token: 0x060039CA RID: 14794 RVA: 0x000C6440 File Offset: 0x000C4640
protected ThreadStateException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.ThreadStateException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
// Token: 0x060039CB RID: 14795 RVA: 0x000C644C File Offset: 0x000C464C
public ThreadStateException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Contains a constant used to specify an infinite amount of time. This class cannot be inherited. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000626 RID: 1574
[ComVisible(true)]
public static class Timeout
{
/// <summary>A constant used to specify an infinite waiting period. This field is constant.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x04001753 RID: 5971
public const int Infinite = -1;
}
}
+456
View File
@@ -0,0 +1,456 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Provides a mechanism for executing a method at specified intervals. This class cannot be inherited.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000627 RID: 1575
[ComVisible(true)]
public sealed class Timer : MarshalByRefObject, IDisposable
{
/// <summary>Initializes a new instance of the Timer class, using a 32-bit signed integer to specify the time interval.</summary>
/// <param name="callback">A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
/// <param name="state">An object containing information to be used by the callback method, or null. </param>
/// <param name="dueTime">The amount of time to delay before <paramref name="callback" /> is invoked, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
/// <param name="period">The time interval between invocations of <paramref name="callback" />, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="callback" /> parameter is null. </exception>
// Token: 0x060039CC RID: 14796 RVA: 0x000C6458 File Offset: 0x000C4658
public Timer(TimerCallback callback, object state, int dueTime, int period)
{
this.Init(callback, state, (long)dueTime, (long)period);
}
/// <summary>Initializes a new instance of the Timer class, using 64-bit signed integers to measure time intervals.</summary>
/// <param name="callback">A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
/// <param name="state">An object containing information to be used by the callback method, or null. </param>
/// <param name="dueTime">The amount of time to delay before <paramref name="callback" /> is invoked, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
/// <param name="period">The time interval between invocations of <paramref name="callback" />, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <exception cref="T:System.NotSupportedException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter is greater than 4294967294. </exception>
// Token: 0x060039CD RID: 14797 RVA: 0x000C6470 File Offset: 0x000C4670
public Timer(TimerCallback callback, object state, long dueTime, long period)
{
this.Init(callback, state, dueTime, period);
}
/// <summary>Initializes a new instance of the Timer class, using <see cref="T:System.TimeSpan" /> values to measure time intervals.</summary>
/// <param name="callback">A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
/// <param name="state">An object containing information to be used by the callback method, or null. </param>
/// <param name="dueTime">The <see cref="T:System.TimeSpan" /> representing the amount of time to delay before the <paramref name="callback" /> parameter invokes its methods. Specify negative one (-1) milliseconds to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
/// <param name="period">The time interval between invocations of the methods referenced by <paramref name="callback" />. Specify negative one (-1) milliseconds to disable periodic signaling. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The number of milliseconds in the value of <paramref name="dueTime" /> or <paramref name="period" /> is negative and not equal to <see cref="F:System.Threading.Timeout.Infinite" />, or is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="callback" /> parameter is null. </exception>
// Token: 0x060039CE RID: 14798 RVA: 0x000C6484 File Offset: 0x000C4684
public Timer(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
{
this.Init(callback, state, (long)dueTime.TotalMilliseconds, (long)period.TotalMilliseconds);
}
/// <summary>Initializes a new instance of the Timer class, using 32-bit unsigned integers to measure time intervals.</summary>
/// <param name="callback">A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
/// <param name="state">An object containing information to be used by the callback method, or null. </param>
/// <param name="dueTime">The amount of time to delay before <paramref name="callback" /> is invoked, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
/// <param name="period">The time interval between invocations of <paramref name="callback" />, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="callback" /> parameter is null. </exception>
// Token: 0x060039CF RID: 14799 RVA: 0x000C64B0 File Offset: 0x000C46B0
[CLSCompliant(false)]
public Timer(TimerCallback callback, object state, uint dueTime, uint period)
{
long num = (long)((dueTime != uint.MaxValue) ? ((ulong)dueTime) : ulong.MaxValue);
long num2 = (long)((period != uint.MaxValue) ? ((ulong)period) : ulong.MaxValue);
this.Init(callback, state, num, num2);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.Timer" /> class with an infinite period and an infinite due time, using the newly created <see cref="T:System.Threading.Timer" /> object as the state object. </summary>
/// <param name="callback">A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed.</param>
// Token: 0x060039D0 RID: 14800 RVA: 0x000C64F4 File Offset: 0x000C46F4
public Timer(TimerCallback callback)
{
this.Init(callback, this, -1L, -1L);
}
// Token: 0x060039D2 RID: 14802 RVA: 0x000C6514 File Offset: 0x000C4714
private void Init(TimerCallback callback, object state, long dueTime, long period)
{
if (callback == null)
{
throw new ArgumentNullException("callback");
}
this.callback = callback;
this.state = state;
this.Change(dueTime, period, true);
}
/// <summary>Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals.</summary>
/// <returns>true if the timer was successfully updated; otherwise, false.</returns>
/// <param name="dueTime">The amount of time to delay before the invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
/// <param name="period">The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.Timer" /> has already been disposed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060039D3 RID: 14803 RVA: 0x000C654C File Offset: 0x000C474C
public bool Change(int dueTime, int period)
{
return this.Change((long)dueTime, (long)period, false);
}
/// <summary>Changes the start time and the interval between method invocations for a timer, using <see cref="T:System.TimeSpan" /> values to measure time intervals.</summary>
/// <returns>true if the timer was successfully updated; otherwise, false.</returns>
/// <param name="dueTime">A <see cref="T:System.TimeSpan" /> representing the amount of time to delay before invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed. Specify negative one (-1) milliseconds to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
/// <param name="period">The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed. Specify negative one (-1) milliseconds to disable periodic signaling. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.Timer" /> has already been disposed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter, in milliseconds, is less than -1. </exception>
/// <exception cref="T:System.NotSupportedException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter, in milliseconds, is greater than 4294967294. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060039D4 RID: 14804 RVA: 0x000C655C File Offset: 0x000C475C
public bool Change(TimeSpan dueTime, TimeSpan period)
{
return this.Change((long)dueTime.TotalMilliseconds, (long)period.TotalMilliseconds, false);
}
/// <summary>Changes the start time and the interval between method invocations for a timer, using 32-bit unsigned integers to measure time intervals.</summary>
/// <returns>true if the timer was successfully updated; otherwise, false.</returns>
/// <param name="dueTime">The amount of time to delay before the invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
/// <param name="period">The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.Timer" /> has already been disposed. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060039D5 RID: 14805 RVA: 0x000C6580 File Offset: 0x000C4780
[CLSCompliant(false)]
public bool Change(uint dueTime, uint period)
{
long num = (long)((dueTime != uint.MaxValue) ? ((ulong)dueTime) : ulong.MaxValue);
long num2 = (long)((period != uint.MaxValue) ? ((ulong)period) : ulong.MaxValue);
return this.Change(num, num2, false);
}
/// <summary>Releases all resources used by the current instance of <see cref="T:System.Threading.Timer" />.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x060039D6 RID: 14806 RVA: 0x000C65B8 File Offset: 0x000C47B8
public void Dispose()
{
if (this.disposed)
{
return;
}
this.disposed = true;
Timer.scheduler.Remove(this);
}
/// <summary>Changes the start time and the interval between method invocations for a timer, using 64-bit signed integers to measure time intervals.</summary>
/// <returns>true if the timer was successfully updated; otherwise, false.</returns>
/// <param name="dueTime">The amount of time to delay before the invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
/// <param name="period">The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.Timer" /> has already been disposed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter is less than -1. </exception>
/// <exception cref="T:System.NotSupportedException">The <paramref name="dueTime" /> or <paramref name="period" /> parameter is greater than 4294967294. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060039D7 RID: 14807 RVA: 0x000C65D8 File Offset: 0x000C47D8
public bool Change(long dueTime, long period)
{
return this.Change(dueTime, period, false);
}
// Token: 0x060039D8 RID: 14808 RVA: 0x000C65E4 File Offset: 0x000C47E4
private bool Change(long dueTime, long period, bool first)
{
if (dueTime > (long)((ulong)(-2)))
{
throw new ArgumentOutOfRangeException("Due time too large");
}
if (period > (long)((ulong)(-2)))
{
throw new ArgumentOutOfRangeException("Period too large");
}
if (dueTime < -1L)
{
throw new ArgumentOutOfRangeException("dueTime");
}
if (period < -1L)
{
throw new ArgumentOutOfRangeException("period");
}
if (this.disposed)
{
return false;
}
this.due_time_ms = dueTime;
this.period_ms = period;
long num;
if (dueTime == 0L)
{
num = 0L;
}
else if (dueTime < 0L)
{
num = long.MaxValue;
if (first)
{
this.next_run = num;
return true;
}
}
else
{
num = dueTime * 10000L + DateTime.GetTimeMonotonic();
}
Timer.scheduler.Change(this, num);
return true;
}
/// <summary>Releases all resources used by the current instance of <see cref="T:System.Threading.Timer" /> and signals when the timer has been disposed of.</summary>
/// <returns>true if the function succeeds; otherwise, false.</returns>
/// <param name="notifyObject">The <see cref="T:System.Threading.WaitHandle" /> to be signaled when the Timer has been disposed of. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="notifyObject" /> parameter is null. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060039D9 RID: 14809 RVA: 0x000C66AC File Offset: 0x000C48AC
public bool Dispose(WaitHandle notifyObject)
{
if (notifyObject == null)
{
throw new ArgumentNullException("notifyObject");
}
this.Dispose();
NativeEventCalls.SetEvent_internal(notifyObject.Handle);
return true;
}
// Token: 0x04001754 RID: 5972
private const long MaxValue = 4294967294L;
// Token: 0x04001755 RID: 5973
private static Timer.Scheduler scheduler = Timer.Scheduler.Instance;
// Token: 0x04001756 RID: 5974
private TimerCallback callback;
// Token: 0x04001757 RID: 5975
private object state;
// Token: 0x04001758 RID: 5976
private long due_time_ms;
// Token: 0x04001759 RID: 5977
private long period_ms;
// Token: 0x0400175A RID: 5978
private long next_run;
// Token: 0x0400175B RID: 5979
private bool disposed;
// Token: 0x02000628 RID: 1576
private sealed class TimerComparer : IComparer
{
// Token: 0x060039DB RID: 14811 RVA: 0x000C66E8 File Offset: 0x000C48E8
public int Compare(object x, object y)
{
Timer timer = x as Timer;
if (timer == null)
{
return -1;
}
Timer timer2 = y as Timer;
if (timer2 == null)
{
return 1;
}
long num = timer.next_run - timer2.next_run;
if (num == 0L)
{
return 0;
}
return (num <= 0L) ? (-1) : 1;
}
}
// Token: 0x02000629 RID: 1577
private sealed class Scheduler
{
// Token: 0x060039DC RID: 14812 RVA: 0x000C6738 File Offset: 0x000C4938
private Scheduler()
{
this.list = new SortedList(new Timer.TimerComparer(), 1024);
new Thread(new ThreadStart(this.SchedulerThread))
{
IsBackground = true
}.Start();
}
// Token: 0x17000B1C RID: 2844
// (get) Token: 0x060039DE RID: 14814 RVA: 0x000C678C File Offset: 0x000C498C
public static Timer.Scheduler Instance
{
get
{
return Timer.Scheduler.instance;
}
}
// Token: 0x060039DF RID: 14815 RVA: 0x000C6794 File Offset: 0x000C4994
public void Remove(Timer timer)
{
if (timer.next_run == 0L || timer.next_run == 9223372036854775807L)
{
return;
}
lock (this)
{
this.InternalRemove(timer);
}
}
// Token: 0x060039E0 RID: 14816 RVA: 0x000C67FC File Offset: 0x000C49FC
public void Change(Timer timer, long new_next_run)
{
lock (this)
{
this.InternalRemove(timer);
if (new_next_run == 9223372036854775807L)
{
timer.next_run = new_next_run;
}
else if (!timer.disposed)
{
timer.next_run = new_next_run;
this.Add(timer);
if (this.list.GetByIndex(0) == timer)
{
Monitor.Pulse(this);
}
}
}
}
// Token: 0x060039E1 RID: 14817 RVA: 0x000C6890 File Offset: 0x000C4A90
private void Add(Timer timer)
{
int num = this.list.IndexOfKey(timer);
if (num != -1)
{
bool flag = long.MaxValue - timer.next_run > 20000L;
Timer timer2;
do
{
num++;
if (flag)
{
timer.next_run += 1L;
}
else
{
timer.next_run -= 1L;
}
if (num >= this.list.Count)
{
break;
}
timer2 = (Timer)this.list.GetByIndex(num);
}
while (timer2.next_run == timer.next_run);
}
this.list.Add(timer, timer);
}
// Token: 0x060039E2 RID: 14818 RVA: 0x000C6954 File Offset: 0x000C4B54
private int InternalRemove(Timer timer)
{
int num = this.list.IndexOfKey(timer);
if (num >= 0)
{
this.list.RemoveAt(num);
}
return num;
}
// Token: 0x060039E3 RID: 14819 RVA: 0x000C6984 File Offset: 0x000C4B84
private void SchedulerThread()
{
Thread.CurrentThread.Name = "Timer-Scheduler";
ArrayList arrayList = new ArrayList(512);
for (;;)
{
long timeMonotonic = DateTime.GetTimeMonotonic();
lock (this)
{
int num = this.list.Count;
for (int i = 0; i < num; i++)
{
Timer timer = (Timer)this.list.GetByIndex(i);
if (timer.next_run > timeMonotonic)
{
break;
}
this.list.RemoveAt(i);
num--;
i--;
ThreadPool.QueueUserWorkItem(new WaitCallback(timer.callback.Invoke), timer.state);
long period_ms = timer.period_ms;
long due_time_ms = timer.due_time_ms;
bool flag = period_ms == -1L || ((period_ms == 0L || period_ms == -1L) && due_time_ms != -1L);
if (flag)
{
timer.next_run = long.MaxValue;
}
else
{
timer.next_run = DateTime.GetTimeMonotonic() + 10000L * timer.period_ms;
arrayList.Add(timer);
}
}
num = arrayList.Count;
for (int i = 0; i < num; i++)
{
Timer timer2 = (Timer)arrayList[i];
this.Add(timer2);
}
arrayList.Clear();
this.ShrinkIfNeeded(arrayList, 512);
int capacity = this.list.Capacity;
num = this.list.Count;
if (capacity > 1024 && num > 0 && capacity / num > 3)
{
this.list.Capacity = num * 2;
}
long num2 = long.MaxValue;
if (this.list.Count > 0)
{
num2 = ((Timer)this.list.GetByIndex(0)).next_run;
}
int num3 = -1;
if (num2 != 9223372036854775807L)
{
long num4 = num2 - DateTime.GetTimeMonotonic();
num3 = (int)(num4 / 10000L);
if (num3 < 0)
{
num3 = 0;
}
}
Monitor.Wait(this, num3);
}
}
}
// Token: 0x060039E4 RID: 14820 RVA: 0x000C6BD8 File Offset: 0x000C4DD8
private void ShrinkIfNeeded(ArrayList list, int initial)
{
int capacity = list.Capacity;
int count = list.Count;
if (capacity > initial && count > 0 && capacity / count > 3)
{
list.Capacity = count * 2;
}
}
// Token: 0x0400175C RID: 5980
private static Timer.Scheduler instance = new Timer.Scheduler();
// Token: 0x0400175D RID: 5981
private SortedList list;
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents the method that handles calls from a <see cref="T:System.Threading.Timer" />.</summary>
/// <param name="state">An object containing application-specific information relevant to the method invoked by this delegate, or null. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x020006E1 RID: 1761
// (Invoke) Token: 0x0600420C RID: 16908
[ComVisible(true)]
public delegate void TimerCallback(object state);
}
+13
View File
@@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents a callback method to be executed by a thread pool thread.</summary>
/// <param name="state">An object containing information to be used by the callback method. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x020006E2 RID: 1762
// (Invoke) Token: 0x06004210 RID: 16912
[ComVisible(true)]
public delegate void WaitCallback(object state);
}
+685
View File
@@ -0,0 +1,685 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Contexts;
using Microsoft.Win32.SafeHandles;
namespace System.Threading
{
/// <summary>Encapsulates operating systemspecific objects that wait for exclusive access to shared resources.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200062A RID: 1578
[ComVisible(true)]
public abstract class WaitHandle : MarshalByRefObject, IDisposable
{
/// <summary>Releases all resources used by the <see cref="T:System.Threading.WaitHandle" />.</summary>
// Token: 0x060039E7 RID: 14823 RVA: 0x000C6C2C File Offset: 0x000C4E2C
void IDisposable.Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
// Token: 0x060039E8 RID: 14824
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool WaitAll_internal(WaitHandle[] handles, int ms, bool exitContext);
// Token: 0x060039E9 RID: 14825 RVA: 0x000C6C3C File Offset: 0x000C4E3C
private static void CheckArray(WaitHandle[] handles, bool waitAll)
{
if (handles == null)
{
throw new ArgumentNullException("waitHandles");
}
int num = handles.Length;
if (num > 64)
{
throw new NotSupportedException("Too many handles");
}
foreach (WaitHandle waitHandle in handles)
{
if (waitHandle == null)
{
throw new ArgumentNullException("waitHandles", "null handle");
}
if (waitHandle.safe_wait_handle == null)
{
throw new ArgumentException("null element found", "waitHandle");
}
}
}
/// <summary>Waits for all the elements in the specified array to receive a signal.</summary>
/// <returns>true when every element in <paramref name="waitHandles" /> has received a signal; otherwise the method never returns.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null. -or- One or more of the objects in the <paramref name="waitHandles" /> array are null. -or-<paramref name="waitHandles" /> is an array with no elements and the .NET Framework version is 2.0 or later. </exception>
/// <exception cref="T:System.DuplicateWaitObjectException">The <paramref name="waitHandles" /> array contains elements that are duplicates. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits.-or- The <see cref="T:System.STAThreadAttribute" /> attribute is applied to the thread procedure for the current thread, and <paramref name="waitHandles" /> contains more than one element. </exception>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="waitHandles" /> is an array with no elements and the .NET Framework version is 1.0 or 1.1. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait terminated because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039EA RID: 14826 RVA: 0x000C6CBC File Offset: 0x000C4EBC
public static bool WaitAll(WaitHandle[] waitHandles)
{
WaitHandle.CheckArray(waitHandles, true);
return WaitHandle.WaitAll_internal(waitHandles, -1, false);
}
/// <summary>Waits for all the elements in the specified array to receive a signal, using an <see cref="T:System.Int32" /> value to specify the time interval and specifying whether to exit the synchronization domain before the wait.</summary>
/// <returns>true when every element in <paramref name="waitHandles" /> has received a signal; otherwise, false.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object (duplicates). </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely. </param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null.-or- One or more of the objects in the <paramref name="waitHandles" /> array is null. -or-<paramref name="waitHandles" /> is an array with no elements and the .NET Framework version is 2.0 or later. </exception>
/// <exception cref="T:System.DuplicateWaitObjectException">The <paramref name="waitHandles" /> array contains elements that are duplicates. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits.-or- The <see cref="T:System.STAThreadAttribute" /> attribute is applied to the thread procedure for the current thread, and <paramref name="waitHandles" /> contains more than one element. </exception>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="waitHandles" /> is an array with no elements and the .NET Framework version is 1.0 or 1.1. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039EB RID: 14827 RVA: 0x000C6CD0 File Offset: 0x000C4ED0
public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
{
WaitHandle.CheckArray(waitHandles, true);
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException("millisecondsTimeout");
}
bool flag;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
flag = WaitHandle.WaitAll_internal(waitHandles, millisecondsTimeout, false);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
}
return flag;
}
/// <summary>Waits for all the elements in the specified array to receive a signal, using a <see cref="T:System.TimeSpan" /> value to specify the time interval, and specifying whether to exit the synchronization domain before the wait.</summary>
/// <returns>true when every element in <paramref name="waitHandles" /> has received a signal; otherwise false.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. </param>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> that represents the number of milliseconds to wait, or a <see cref="T:System.TimeSpan" /> that represents -1 milliseconds, to wait indefinitely. </param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null. -or- One or more of the objects in the <paramref name="waitHandles" /> array is null. -or-<paramref name="waitHandles" /> is an array with no elements and the .NET Framework version is 2.0 or later. </exception>
/// <exception cref="T:System.DuplicateWaitObjectException">The <paramref name="waitHandles" /> array contains elements that are duplicates. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits.-or- The <see cref="T:System.STAThreadAttribute" /> attribute is applied to the thread procedure for the current thread, and <paramref name="waitHandles" /> contains more than one element. </exception>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="waitHandles" /> is an array with no elements and the .NET Framework version is 1.0 or 1.1. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out. -or-<paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait terminated because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039EC RID: 14828 RVA: 0x000C6D40 File Offset: 0x000C4F40
public static bool WaitAll(WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext)
{
WaitHandle.CheckArray(waitHandles, true);
long num = (long)timeout.TotalMilliseconds;
if (num < -1L || num > 2147483647L)
{
throw new ArgumentOutOfRangeException("timeout");
}
bool flag;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
flag = WaitHandle.WaitAll_internal(waitHandles, (int)num, exitContext);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
}
return flag;
}
// Token: 0x060039ED RID: 14829
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int WaitAny_internal(WaitHandle[] handles, int ms, bool exitContext);
/// <summary>Waits for any of 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">A WaitHandle array containing the objects for which the current instance will wait. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null.-or-One or more of the objects in the <paramref name="waitHandles" /> array is null. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits. </exception>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="waitHandles" /> is an array with no elements, and the .NET Framework version is 1.0 or 1.1. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="waitHandles" /> is an array with no elements, and the .NET Framework version is 2.0 or later. </exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039EE RID: 14830 RVA: 0x000C6DC4 File Offset: 0x000C4FC4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int WaitAny(WaitHandle[] waitHandles)
{
WaitHandle.CheckArray(waitHandles, false);
return WaitHandle.WaitAny_internal(waitHandles, -1, false);
}
/// <summary>Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed integer to specify the time interval, and specifying whether to exit the synchronization domain before the wait.</summary>
/// <returns>The array index of the object that satisfied the wait, or <see cref="F:System.Threading.WaitHandle.WaitTimeout" /> if no object satisfied the wait and a time interval equivalent to <paramref name="millisecondsTimeout" /> has passed.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely. </param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null.-or-One or more of the objects in the <paramref name="waitHandles" /> array is null. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits. </exception>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="waitHandles" /> is an array with no elements, and the .NET Framework version is 1.0 or 1.1. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="waitHandles" /> is an array with no elements, and the .NET Framework version is 2.0 or later. </exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039EF RID: 14831 RVA: 0x000C6DD8 File Offset: 0x000C4FD8
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
{
WaitHandle.CheckArray(waitHandles, false);
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException("millisecondsTimeout");
}
int num;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
num = WaitHandle.WaitAny_internal(waitHandles, millisecondsTimeout, exitContext);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
}
return num;
}
/// <summary>Waits for any of the elements in the specified array to receive a signal, using a <see cref="T:System.TimeSpan" /> to specify the time interval.</summary>
/// <returns>The array index of the object that satisfied the wait, or <see cref="F:System.Threading.WaitHandle.WaitTimeout" /> if no object satisfied the wait and a time interval equivalent to <paramref name="timeout" /> has passed.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. </param>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> that represents the number of milliseconds to wait, or a <see cref="T:System.TimeSpan" /> that represents -1 milliseconds to wait indefinitely. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null.-or-One or more of the objects in the <paramref name="waitHandles" /> array is null. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out. -or-<paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="waitHandles" /> is an array with no elements. </exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
// Token: 0x060039F0 RID: 14832 RVA: 0x000C6E48 File Offset: 0x000C5048
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int WaitAny(WaitHandle[] waitHandles, TimeSpan timeout)
{
return WaitHandle.WaitAny(waitHandles, timeout, false);
}
/// <summary>Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed integer to specify the time interval.</summary>
/// <returns>The array index of the object that satisfied the wait, or <see cref="F:System.Threading.WaitHandle.WaitTimeout" /> if no object satisfied the wait and a time interval equivalent to <paramref name="millisecondsTimeout" /> has passed.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null.-or-One or more of the objects in the <paramref name="waitHandles" /> array is null. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="waitHandles" /> is an array with no elements. </exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
// Token: 0x060039F1 RID: 14833 RVA: 0x000C6E54 File Offset: 0x000C5054
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout)
{
return WaitHandle.WaitAny(waitHandles, millisecondsTimeout, false);
}
/// <summary>Waits for any of the elements in the specified array to receive a signal, using a <see cref="T:System.TimeSpan" /> to specify the time interval and specifying whether to exit the synchronization domain before the wait.</summary>
/// <returns>The array index of the object that satisfied the wait, or <see cref="F:System.Threading.WaitHandle.WaitTimeout" /> if no object satisfied the wait and a time interval equivalent to <paramref name="timeout" /> has passed.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. </param>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> that represents the number of milliseconds to wait, or a <see cref="T:System.TimeSpan" /> that represents -1 milliseconds to wait indefinitely. </param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null.-or-One or more of the objects in the <paramref name="waitHandles" /> array is null. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits. </exception>
/// <exception cref="T:System.ApplicationException">
/// <paramref name="waitHandles" /> is an array with no elements, and the .NET Framework version is 1.0 or 1.1. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out. -or-<paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="waitHandles" /> is an array with no elements, and the .NET Framework version is 2.0 or later. </exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039F2 RID: 14834 RVA: 0x000C6E60 File Offset: 0x000C5060
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int WaitAny(WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext)
{
WaitHandle.CheckArray(waitHandles, false);
long num = (long)timeout.TotalMilliseconds;
if (num < -1L || num > 2147483647L)
{
throw new ArgumentOutOfRangeException("timeout");
}
int num2;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
num2 = WaitHandle.WaitAny_internal(waitHandles, (int)num, exitContext);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
}
return num2;
}
/// <summary>When overridden in a derived class, releases all resources held by the current <see cref="T:System.Threading.WaitHandle" />.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x060039F3 RID: 14835 RVA: 0x000C6EE4 File Offset: 0x000C50E4
public virtual void Close()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Gets or sets the native operating system handle.</summary>
/// <returns>An IntPtr representing the native operating system handle. The default is the value of the <see cref="F:System.Threading.WaitHandle.InvalidHandle" /> field.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B1D RID: 2845
// (get) Token: 0x060039F4 RID: 14836 RVA: 0x000C6EF4 File Offset: 0x000C50F4
// (set) Token: 0x060039F5 RID: 14837 RVA: 0x000C6F04 File Offset: 0x000C5104
[Obsolete("In the profiles > 2.x, use SafeHandle instead of Handle")]
public virtual IntPtr Handle
{
get
{
return this.safe_wait_handle.DangerousGetHandle();
}
set
{
if (value == WaitHandle.InvalidHandle)
{
this.safe_wait_handle = new SafeWaitHandle(WaitHandle.InvalidHandle, false);
}
else
{
this.safe_wait_handle = new SafeWaitHandle(value, true);
}
}
}
// Token: 0x060039F6 RID: 14838
[MethodImpl(MethodImplOptions.InternalCall)]
private extern bool WaitOne_internal(IntPtr handle, int ms, bool exitContext);
/// <summary>When overridden in a derived class, releases the unmanaged resources used by the <see cref="T:System.Threading.WaitHandle" />, and optionally releases the managed resources.</summary>
/// <param name="explicitDisposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
// Token: 0x060039F7 RID: 14839 RVA: 0x000C6F3C File Offset: 0x000C513C
protected virtual void Dispose(bool explicitDisposing)
{
if (!this.disposed)
{
this.disposed = true;
if (this.safe_wait_handle == null)
{
return;
}
lock (this)
{
if (this.safe_wait_handle != null)
{
this.safe_wait_handle.Dispose();
}
}
}
}
/// <summary>Gets or sets the native operating system handle.</summary>
/// <returns>A <see cref="T:Microsoft.Win32.SafeHandles.SafeWaitHandle" /> representing the native operating system handle.</returns>
// Token: 0x17000B1E RID: 2846
// (get) Token: 0x060039F8 RID: 14840 RVA: 0x000C6FB0 File Offset: 0x000C51B0
// (set) Token: 0x060039F9 RID: 14841 RVA: 0x000C6FB8 File Offset: 0x000C51B8
public SafeWaitHandle SafeWaitHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
get
{
return this.safe_wait_handle;
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
set
{
if (value == null)
{
this.safe_wait_handle = new SafeWaitHandle(WaitHandle.InvalidHandle, false);
}
else
{
this.safe_wait_handle = value;
}
}
}
/// <summary>Signals one wait handle and waits on another.</summary>
/// <returns>true if both the signal and the wait complete successfully; if the wait does not complete, the method does not return.</returns>
/// <param name="toSignal">The wait handle to signal.</param>
/// <param name="toWaitOn">The wait handle to wait on.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="toSignal" /> is null.-or-<paramref name="toWaitOn" /> is null. </exception>
/// <exception cref="T:System.NotSupportedException">The method was called on a thread that has <see cref="T:System.STAThreadAttribute" />. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">This method is not supported on Windows 98 or Windows Millennium Edition. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="toSignal" /> is a semaphore, and it already has a full count. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039FA RID: 14842 RVA: 0x000C6FE0 File Offset: 0x000C51E0
public static bool SignalAndWait(WaitHandle toSignal, WaitHandle toWaitOn)
{
return WaitHandle.SignalAndWait(toSignal, toWaitOn, -1, false);
}
/// <summary>Signals one wait handle and waits on another, specifying a time-out interval as a 32-bit signed integer and specifying whether to exit the synchronization domain for the context before entering the wait.</summary>
/// <returns>true if both the signal and the wait completed successfully, or false if the signal completed but the wait timed out.</returns>
/// <param name="toSignal">The wait handle to signal.</param>
/// <param name="toWaitOn">The wait handle to wait on.</param>
/// <param name="millisecondsTimeout">An integer that represents the interval to wait. If the value is <see cref="F:System.Threading.Timeout.Infinite" />, that is, -1, the wait is infinite.</param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="toSignal" /> is null.-or-<paramref name="toWaitOn" /> is null. </exception>
/// <exception cref="T:System.NotSupportedException">The method is called on a thread that has <see cref="T:System.STAThreadAttribute" />. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">This method is not supported on Windows 98 or Windows Millennium Edition. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="toSignal" /> is a semaphore, and it already has a full count. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Threading.WaitHandle" /> cannot be signaled because it would exceed its maximum count.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039FB RID: 14843 RVA: 0x000C6FEC File Offset: 0x000C51EC
public static bool SignalAndWait(WaitHandle toSignal, WaitHandle toWaitOn, int millisecondsTimeout, bool exitContext)
{
if (toSignal == null)
{
throw new ArgumentNullException("toSignal");
}
if (toWaitOn == null)
{
throw new ArgumentNullException("toWaitOn");
}
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException("millisecondsTimeout");
}
return WaitHandle.SignalAndWait_Internal(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout, exitContext);
}
/// <summary>Signals one wait handle and waits on another, specifying the time-out interval as a <see cref="T:System.TimeSpan" /> and specifying whether to exit the synchronization domain for the context before entering the wait.</summary>
/// <returns>true if both the signal and the wait completed successfully, or false if the signal completed but the wait timed out.</returns>
/// <param name="toSignal">The wait handle to signal.</param>
/// <param name="toWaitOn">The wait handle to wait on.</param>
/// <param name="timeout">The interval to wait. If the value is -1, the wait is infinite.</param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="toSignal" /> is null.-or-<paramref name="toWaitOn" /> is null. </exception>
/// <exception cref="T:System.NotSupportedException">The method was called on a thread that has <see cref="T:System.STAThreadAttribute" />. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">This method is not supported on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="toSignal" /> is a semaphore, and it already has a full count. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> evaluates to a negative number of milliseconds other than -1. -or-<paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060039FC RID: 14844 RVA: 0x000C7040 File Offset: 0x000C5240
public static bool SignalAndWait(WaitHandle toSignal, WaitHandle toWaitOn, TimeSpan timeout, bool exitContext)
{
double totalMilliseconds = timeout.TotalMilliseconds;
if (totalMilliseconds > 2147483647.0)
{
throw new ArgumentOutOfRangeException("timeout");
}
return WaitHandle.SignalAndWait(toSignal, toWaitOn, Convert.ToInt32(totalMilliseconds), false);
}
// Token: 0x060039FD RID: 14845
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool SignalAndWait_Internal(IntPtr toSignal, IntPtr toWaitOn, int ms, bool exitContext);
/// <summary>Blocks the current thread until the current wait handle receives a signal.</summary>
/// <returns>true if the current instance receives a signal. If the current instance is never signaled, <see cref="M:System.Threading.WaitHandle.WaitOne(System.Int32,System.Boolean)" /> never returns.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The current instance is a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060039FE RID: 14846 RVA: 0x000C7080 File Offset: 0x000C5280
public virtual bool WaitOne()
{
this.CheckDisposed();
bool flag = false;
bool flag2;
try
{
this.safe_wait_handle.DangerousAddRef(ref flag);
flag2 = this.WaitOne_internal(this.safe_wait_handle.DangerousGetHandle(), -1, false);
}
finally
{
if (flag)
{
this.safe_wait_handle.DangerousRelease();
}
}
return flag2;
}
/// <summary>Blocks the current thread until the current wait handle receives a signal, using a 32-bit signed integer to specify the time interval and specifying whether to exit the synchronization domain before the wait.</summary>
/// <returns>true if the current instance receives a signal; otherwise, false.</returns>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely. </param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The current instance is a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060039FF RID: 14847 RVA: 0x000C70F0 File Offset: 0x000C52F0
public virtual bool WaitOne(int millisecondsTimeout, bool exitContext)
{
this.CheckDisposed();
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException("millisecondsTimeout");
}
bool flag = false;
bool flag2;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
this.safe_wait_handle.DangerousAddRef(ref flag);
flag2 = this.WaitOne_internal(this.safe_wait_handle.DangerousGetHandle(), millisecondsTimeout, exitContext);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
if (flag)
{
this.safe_wait_handle.DangerousRelease();
}
}
return flag2;
}
/// <summary>Blocks the current thread until the current wait handle receives a signal, using a 32-bit signed integer to specify the time interval.</summary>
/// <returns>true if the current instance receives a signal; otherwise, false.</returns>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely. </param>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The current instance is a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
// Token: 0x06003A00 RID: 14848 RVA: 0x000C7188 File Offset: 0x000C5388
public virtual bool WaitOne(int millisecondsTimeout)
{
return this.WaitOne(millisecondsTimeout, false);
}
/// <summary>Blocks the current thread until the current instance receives a signal, using a <see cref="T:System.TimeSpan" /> to specify the time interval.</summary>
/// <returns>true if the current instance receives a signal; otherwise, false.</returns>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> that represents the number of milliseconds to wait, or a <see cref="T:System.TimeSpan" /> that represents -1 milliseconds to wait indefinitely. </param>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out.-or-<paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The current instance is a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
// Token: 0x06003A01 RID: 14849 RVA: 0x000C7194 File Offset: 0x000C5394
public virtual bool WaitOne(TimeSpan timeout)
{
return this.WaitOne(timeout, false);
}
/// <summary>Blocks the current thread until the current instance receives a signal, using a <see cref="T:System.TimeSpan" /> to specify the time interval and specifying whether to exit the synchronization domain before the wait.</summary>
/// <returns>true if the current instance receives a signal; otherwise, false.</returns>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> that represents the number of milliseconds to wait, or a <see cref="T:System.TimeSpan" /> that represents -1 milliseconds to wait indefinitely. </param>
/// <param name="exitContext">true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false. </param>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out.-or-<paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The current instance is a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
/// <filterpriority>2</filterpriority>
// Token: 0x06003A02 RID: 14850 RVA: 0x000C71A0 File Offset: 0x000C53A0
public virtual bool WaitOne(TimeSpan timeout, bool exitContext)
{
this.CheckDisposed();
long num = (long)timeout.TotalMilliseconds;
if (num < -1L || num > 2147483647L)
{
throw new ArgumentOutOfRangeException("timeout");
}
bool flag = false;
bool flag2;
try
{
if (exitContext)
{
SynchronizationAttribute.ExitContext();
}
this.safe_wait_handle.DangerousAddRef(ref flag);
flag2 = this.WaitOne_internal(this.safe_wait_handle.DangerousGetHandle(), (int)num, exitContext);
}
finally
{
if (exitContext)
{
SynchronizationAttribute.EnterContext();
}
if (flag)
{
this.safe_wait_handle.DangerousRelease();
}
}
return flag2;
}
// Token: 0x06003A03 RID: 14851 RVA: 0x000C7250 File Offset: 0x000C5450
internal void CheckDisposed()
{
if (this.disposed || this.safe_wait_handle == null)
{
throw new ObjectDisposedException(base.GetType().FullName);
}
}
/// <summary>Waits for all the elements in the specified array to receive a signal, using an <see cref="T:System.Int32" /> value to specify the time interval.</summary>
/// <returns>true when every element in <paramref name="waitHandles" /> has received a signal; otherwise, false.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object (duplicates). </param>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null.-or- One or more of the objects in the <paramref name="waitHandles" /> array is null. -or-<paramref name="waitHandles" /> is an array with no elements. </exception>
/// <exception cref="T:System.DuplicateWaitObjectException">The <paramref name="waitHandles" /> array contains elements that are duplicates. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits.-or- The <see cref="T:System.STAThreadAttribute" /> attribute is applied to the thread procedure for the current thread, and <paramref name="waitHandles" /> contains more than one element. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out. </exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait completed because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
// Token: 0x06003A04 RID: 14852 RVA: 0x000C727C File Offset: 0x000C547C
public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout)
{
return WaitHandle.WaitAll(waitHandles, millisecondsTimeout, false);
}
/// <summary>Waits for all the elements in the specified array to receive a signal, using a <see cref="T:System.TimeSpan" /> value to specify the time interval.</summary>
/// <returns>true when every element in <paramref name="waitHandles" /> has received a signal; otherwise, false.</returns>
/// <param name="waitHandles">A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. </param>
/// <param name="timeout">A <see cref="T:System.TimeSpan" /> that represents the number of milliseconds to wait, or a <see cref="T:System.TimeSpan" /> that represents -1 milliseconds, to wait indefinitely. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="waitHandles" /> parameter is null. -or- One or more of the objects in the <paramref name="waitHandles" /> array is null. -or-<paramref name="waitHandles" /> is an array with no elements. </exception>
/// <exception cref="T:System.DuplicateWaitObjectException">The <paramref name="waitHandles" /> array contains elements that are duplicates. </exception>
/// <exception cref="T:System.NotSupportedException">The number of objects in <paramref name="waitHandles" /> is greater than the system permits.-or- The <see cref="T:System.STAThreadAttribute" /> attribute is applied to the thread procedure for the current thread, and <paramref name="waitHandles" /> contains more than one element. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out. -or-<paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.Threading.AbandonedMutexException">The wait terminated because a thread exited without releasing a mutex. This exception is not thrown on Windows 98 or Windows Millennium Edition.</exception>
/// <exception cref="T:System.InvalidOperationException">The <paramref name="waitHandles" /> array contains a transparent proxy for a <see cref="T:System.Threading.WaitHandle" /> in another application domain.</exception>
// Token: 0x06003A05 RID: 14853 RVA: 0x000C7288 File Offset: 0x000C5488
public static bool WaitAll(WaitHandle[] waitHandles, TimeSpan timeout)
{
return WaitHandle.WaitAll(waitHandles, timeout, false);
}
/// <summary>Releases the resources held by the current instance.</summary>
// Token: 0x06003A06 RID: 14854 RVA: 0x000C7294 File Offset: 0x000C5494
~WaitHandle()
{
this.Dispose(false);
}
/// <summary>Indicates that a <see cref="M:System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[],System.Int32,System.Boolean)" /> operation timed out before any of the wait handles were signaled. This field is constant.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x0400175E RID: 5982
public const int WaitTimeout = 258;
// Token: 0x0400175F RID: 5983
private SafeWaitHandle safe_wait_handle;
/// <summary>Represents an invalid native operating system handle. This field is read-only.</summary>
// Token: 0x04001760 RID: 5984
protected static readonly IntPtr InvalidHandle = (IntPtr)(-1);
// Token: 0x04001761 RID: 5985
private bool disposed;
}
}
@@ -0,0 +1,47 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading
{
/// <summary>The exception that is thrown when an attempt is made to open a system mutex or semaphore that does not exist.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200062B RID: 1579
[ComVisible(false)]
[Serializable]
public class WaitHandleCannotBeOpenedException : ApplicationException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.WaitHandleCannotBeOpenedException" /> class with default values.</summary>
// Token: 0x06003A07 RID: 14855 RVA: 0x000C72D0 File Offset: 0x000C54D0
public WaitHandleCannotBeOpenedException()
: base(Locale.GetText("Named handle doesn't exists."))
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.WaitHandleCannotBeOpenedException" /> class with a specified error message.</summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
// Token: 0x06003A08 RID: 14856 RVA: 0x000C72E4 File Offset: 0x000C54E4
public WaitHandleCannotBeOpenedException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.WaitHandleCannotBeOpenedException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception.</param>
// Token: 0x06003A09 RID: 14857 RVA: 0x000C72F0 File Offset: 0x000C54F0
public WaitHandleCannotBeOpenedException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.WaitHandleCannotBeOpenedException" /> class with serialized data.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains contextual information about the source or destination.</param>
// Token: 0x06003A0A RID: 14858 RVA: 0x000C72FC File Offset: 0x000C54FC
protected WaitHandleCannotBeOpenedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
@@ -0,0 +1,14 @@
using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// <summary>Represents a method to be called when a <see cref="T:System.Threading.WaitHandle" /> is signaled or times out.</summary>
/// <param name="state">An object containing information to be used by the callback method each time it executes. </param>
/// <param name="timedOut">true if the <see cref="T:System.Threading.WaitHandle" /> timed out; false if it was signaled. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x020006E3 RID: 1763
// (Invoke) Token: 0x06004214 RID: 16916
[ComVisible(true)]
public delegate void WaitOrTimerCallback(object state, bool timedOut);
}