using System;
using System.Security;
namespace System.Threading
{
/// Provides the functionality to restore the migration, or flow, of the execution context between threads.
/// 2
// 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;
}
/// Releases all resources used by the .
// 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;
}
}
/// Restores the flow of the execution context between threads.
/// The structure is not used on the thread where it was created.-or-The structure has already been used to call .
/// 2
// 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;
}
/// Gets a hash code for the current structure.
/// A hash code for the current structure.
// Token: 0x06003889 RID: 14473 RVA: 0x000C3CF4 File Offset: 0x000C1EF4
public override int GetHashCode()
{
return base.GetHashCode();
}
/// Determines whether the specified object is equal to the current structure.
/// true if is an structure and is equal to the current structure; otherwise, false.
/// An object to compare with the current structure.
// Token: 0x0600388A RID: 14474 RVA: 0x000C3D08 File Offset: 0x000C1F08
public override bool Equals(object obj)
{
return obj is AsyncFlowControl && obj.Equals(this);
}
/// Determines whether the specified structure is equal to the current structure.
/// true if is equal to the current structure; otherwise, false.
/// An structure to compare with the current structure.
// Token: 0x0600388B RID: 14475 RVA: 0x000C3D28 File Offset: 0x000C1F28
public bool Equals(AsyncFlowControl obj)
{
return this._t == obj._t && this._type == obj._type;
}
/// Compares two structures to determine whether they are equal.
/// true if the two structures are equal; otherwise, false.
/// An structure.
/// An structure.
// Token: 0x0600388C RID: 14476 RVA: 0x000C3D54 File Offset: 0x000C1F54
public static bool operator ==(AsyncFlowControl a, AsyncFlowControl b)
{
return a.Equals(b);
}
/// Compares two structures to determine whether they are not equal.
/// true if the structures are not equal; otherwise, false.
/// An structure.
/// An structure.
// 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;
}
}