Files
27Aug2021-Cpp2IL-Dump/mscorlib/System/Threading/SemaphoreSlim.cs
T
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

288 lines
14 KiB
C#

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Cpp2IlInjected;
namespace System.Threading
{
/// <summary>Represents a lightweight alternative to <see cref="T:System.Threading.Semaphore" /> that limits the number of threads that can access a resource or pool of resources concurrently.</summary>
// Token: 0x02000326 RID: 806
[Token(Token = "0x2000326")]
[ComVisible(false)]
[DebuggerDisplay("Current Count = {m_currentCount}")]
public class SemaphoreSlim : IDisposable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Threading.SemaphoreSlim" /> class, specifying the initial and maximum number of requests that can be granted concurrently.</summary>
/// <param name="initialCount">The initial number of requests for the semaphore that can be granted concurrently.</param>
/// <param name="maxCount">The maximum number of requests for the semaphore that can be granted concurrently.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="initialCount" /> is less than 0, or <paramref name="initialCount" /> is greater than <paramref name="maxCount" />, or <paramref name="maxCount" /> is equal to or less than 0.</exception>
// Token: 0x06001EDD RID: 7901 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EDD")]
[Address(RVA = "0xB44D50", Offset = "0xB43D50", VA = "0x180B44D50")]
public SemaphoreSlim(int initialCount, int maxCount)
{
}
/// <summary>Blocks the current thread until it can enter the <see cref="T:System.Threading.SemaphoreSlim" />.</summary>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed.</exception>
// Token: 0x06001EDE RID: 7902 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EDE")]
[Address(RVA = "0xB44C90", Offset = "0xB43C90", VA = "0x180B44C90")]
public void Wait()
{
}
/// <summary>Blocks the current thread until it can enter the <see cref="T:System.Threading.SemaphoreSlim" />, using a 32-bit signed integer that specifies the timeout.</summary>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, <see cref="F:System.Threading.Timeout.Infinite" />(-1) to wait indefinitely, or zero to test the state of the wait handle and return immediately.</param>
/// <returns>
/// <see langword="true" /> if the current thread successfully entered the <see cref="T:System.Threading.SemaphoreSlim" />; otherwise, <see langword="false" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite timeout -or- timeout is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.SemaphoreSlim" /> has been disposed.</exception>
// Token: 0x06001EDF RID: 7903 RVA: 0x00014F58 File Offset: 0x00013158
[Token(Token = "0x6001EDF")]
[Address(RVA = "0xB44810", Offset = "0xB43810", VA = "0x180B44810")]
public bool Wait(int millisecondsTimeout)
{
return default(bool);
}
/// <summary>Blocks the current thread until it can enter the <see cref="T:System.Threading.SemaphoreSlim" />, using a 32-bit signed integer that specifies the timeout, while observing a <see cref="T:System.Threading.CancellationToken" />.</summary>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, <see cref="F:System.Threading.Timeout.Infinite" />(-1) to wait indefinitely, or zero to test the state of the wait handle and return immediately.</param>
/// <param name="cancellationToken">The <see cref="T:System.Threading.CancellationToken" /> to observe.</param>
/// <returns>
/// <see langword="true" /> if the current thread successfully entered the <see cref="T:System.Threading.SemaphoreSlim" />; otherwise, <see langword="false" />.</returns>
/// <exception cref="T:System.OperationCanceledException">
/// <paramref name="cancellationToken" /> was canceled.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite timeout -or- timeout is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.SemaphoreSlim" /> instance has been disposed, or the <see cref="T:System.Threading.CancellationTokenSource" /> that created <paramref name="cancellationToken" /> has been disposed.</exception>
// Token: 0x06001EE0 RID: 7904 RVA: 0x00014F70 File Offset: 0x00013170
[Token(Token = "0x6001EE0")]
[Address(RVA = "0xB44820", Offset = "0xB43820", VA = "0x180B44820")]
public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
{
return default(bool);
}
// Token: 0x06001EE1 RID: 7905 RVA: 0x00014F88 File Offset: 0x00013188
[Token(Token = "0x6001EE1")]
[Address(RVA = "0xB44790", Offset = "0xB43790", VA = "0x180B44790")]
private bool WaitUntilCountOrTimeout(int millisecondsTimeout, uint startTime, CancellationToken cancellationToken)
{
return default(bool);
}
/// <summary>Asynchronously waits to enter the <see cref="T:System.Threading.SemaphoreSlim" />.</summary>
/// <returns>A task that will complete when the semaphore has been entered.</returns>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.SemaphoreSlim" /> has been disposed.</exception>
// Token: 0x06001EE2 RID: 7906 RVA: 0x00002082 File Offset: 0x00000282
[Token(Token = "0x6001EE2")]
[Address(RVA = "0xB44670", Offset = "0xB43670", VA = "0x180B44670")]
public Task WaitAsync()
{
return null;
}
/// <summary>Asynchronously waits to enter the <see cref="T:System.Threading.SemaphoreSlim" />, using a 32-bit signed integer to measure the time interval, while observing a <see cref="T:System.Threading.CancellationToken" />.</summary>
/// <param name="millisecondsTimeout">The number of milliseconds to wait, <see cref="F:System.Threading.Timeout.Infinite" /> (-1) to wait indefinitely, or zero to test the state of the wait handle and return immediately.</param>
/// <param name="cancellationToken">The <see cref="T:System.Threading.CancellationToken" /> to observe.</param>
/// <returns>A task that will complete with a result of <see langword="true" /> if the current thread successfully entered the <see cref="T:System.Threading.SemaphoreSlim" />, otherwise with a result of <see langword="false" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="millisecondsTimeout" /> is a number other than -1, which represents an infinite timeout -or- timeout is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed.</exception>
/// <exception cref="T:System.OperationCanceledException">
/// <paramref name="cancellationToken" /> was canceled.</exception>
// Token: 0x06001EE3 RID: 7907 RVA: 0x00002082 File Offset: 0x00000282
[Token(Token = "0x6001EE3")]
[Address(RVA = "0xB44270", Offset = "0xB43270", VA = "0x180B44270")]
public Task<bool> WaitAsync(int millisecondsTimeout, CancellationToken cancellationToken)
{
return null;
}
// Token: 0x06001EE4 RID: 7908 RVA: 0x00002082 File Offset: 0x00000282
[Token(Token = "0x6001EE4")]
[Address(RVA = "0xB43D90", Offset = "0xB42D90", VA = "0x180B43D90")]
private SemaphoreSlim.TaskNode CreateAndAddAsyncWaiter()
{
return null;
}
// Token: 0x06001EE5 RID: 7909 RVA: 0x00014FA0 File Offset: 0x000131A0
[Token(Token = "0x6001EE5")]
[Address(RVA = "0xB441F0", Offset = "0xB431F0", VA = "0x180B441F0")]
private bool RemoveAsyncWaiter(SemaphoreSlim.TaskNode task)
{
return default(bool);
}
// Token: 0x06001EE6 RID: 7910 RVA: 0x00002082 File Offset: 0x00000282
[Token(Token = "0x6001EE6")]
[Address(RVA = "0xB44680", Offset = "0xB43680", VA = "0x180B44680")]
private Task<bool> WaitUntilCountOrTimeoutAsync(SemaphoreSlim.TaskNode asyncWaiter, int millisecondsTimeout, CancellationToken cancellationToken)
{
return null;
}
/// <summary>Releases the <see cref="T:System.Threading.SemaphoreSlim" /> object once.</summary>
/// <returns>The previous count of the <see cref="T:System.Threading.SemaphoreSlim" />.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed.</exception>
/// <exception cref="T:System.Threading.SemaphoreFullException">The <see cref="T:System.Threading.SemaphoreSlim" /> has already reached its maximum size.</exception>
// Token: 0x06001EE7 RID: 7911 RVA: 0x00014FB8 File Offset: 0x000131B8
[Token(Token = "0x6001EE7")]
[Address(RVA = "0xB43F70", Offset = "0xB42F70", VA = "0x180B43F70")]
public int Release()
{
return 0;
}
/// <summary>Releases the <see cref="T:System.Threading.SemaphoreSlim" /> object a specified number of times.</summary>
/// <param name="releaseCount">The number of times to exit the semaphore.</param>
/// <returns>The previous count of the <see cref="T:System.Threading.SemaphoreSlim" />.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="releaseCount" /> is less than 1.</exception>
/// <exception cref="T:System.Threading.SemaphoreFullException">The <see cref="T:System.Threading.SemaphoreSlim" /> has already reached its maximum size.</exception>
// Token: 0x06001EE8 RID: 7912 RVA: 0x00014FD0 File Offset: 0x000131D0
[Token(Token = "0x6001EE8")]
[Address(RVA = "0xB43F80", Offset = "0xB42F80", VA = "0x180B43F80")]
public int Release(int releaseCount)
{
return 0;
}
// Token: 0x06001EE9 RID: 7913 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EE9")]
[Address(RVA = "0xB43F60", Offset = "0xB42F60", VA = "0x180B43F60")]
private static void QueueWaiterTask(SemaphoreSlim.TaskNode waiterTask)
{
}
/// <summary>Releases all resources used by the current instance of the <see cref="T:System.Threading.SemaphoreSlim" /> class.</summary>
// Token: 0x06001EEA RID: 7914 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EEA")]
[Address(RVA = "0xB43EE0", Offset = "0xB42EE0", VA = "0x180B43EE0", Slot = "4")]
public void Dispose()
{
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Threading.SemaphoreSlim" />, and optionally releases the managed resources.</summary>
/// <param name="disposing">
/// <see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param>
// Token: 0x06001EEB RID: 7915 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EEB")]
[Address(RVA = "0xB43E60", Offset = "0xB42E60", VA = "0x180B43E60", Slot = "5")]
protected virtual void Dispose(bool disposing)
{
}
// Token: 0x06001EEC RID: 7916 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EEC")]
[Address(RVA = "0xB43BF0", Offset = "0xB42BF0", VA = "0x180B43BF0")]
private static void CancellationTokenCanceledEventHandler(object obj)
{
}
// Token: 0x06001EED RID: 7917 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EED")]
[Address(RVA = "0xB43CF0", Offset = "0xB42CF0", VA = "0x180B43CF0")]
private void CheckDispose()
{
}
// Token: 0x06001EEE RID: 7918 RVA: 0x00002082 File Offset: 0x00000282
[Token(Token = "0x6001EEE")]
[Address(RVA = "0xB43F50", Offset = "0xB42F50", VA = "0x180B43F50")]
private static string GetResourceString(string str)
{
return null;
}
// Token: 0x04001144 RID: 4420
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
[Token(Token = "0x4001144")]
private int m_currentCount;
// Token: 0x04001145 RID: 4421
[global::Cpp2IlInjected.FieldOffset(Offset = "0x14")]
[Token(Token = "0x4001145")]
private readonly int m_maxCount;
// Token: 0x04001146 RID: 4422
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
[Token(Token = "0x4001146")]
private int m_waitCount;
// Token: 0x04001147 RID: 4423
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
[Token(Token = "0x4001147")]
private object m_lockObj;
// Token: 0x04001148 RID: 4424
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
[Token(Token = "0x4001148")]
private ManualResetEvent m_waitHandle;
// Token: 0x04001149 RID: 4425
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
[Token(Token = "0x4001149")]
private SemaphoreSlim.TaskNode m_asyncHead;
// Token: 0x0400114A RID: 4426
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
[Token(Token = "0x400114A")]
private SemaphoreSlim.TaskNode m_asyncTail;
// Token: 0x0400114B RID: 4427
[Token(Token = "0x400114B")]
private static readonly Task<bool> s_trueTask;
// Token: 0x0400114C RID: 4428
[Token(Token = "0x400114C")]
private const int NO_MAXIMUM = 2147483647;
// Token: 0x0400114D RID: 4429
[Token(Token = "0x400114D")]
private static Action<object> s_cancellationTokenCanceledEventHandler;
// Token: 0x02000327 RID: 807
[Token(Token = "0x2000327")]
private sealed class TaskNode : Task<bool>, IThreadPoolWorkItem
{
// Token: 0x06001EF0 RID: 7920 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EF0")]
[Address(RVA = "0xB48820", Offset = "0xB47820", VA = "0x180B48820")]
internal TaskNode()
{
}
// Token: 0x06001EF1 RID: 7921 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EF1")]
[Address(RVA = "0xB487E0", Offset = "0xB477E0", VA = "0x180B487E0", Slot = "4")]
void IThreadPoolWorkItem.ExecuteWorkItem()
{
}
// Token: 0x06001EF2 RID: 7922 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x6001EF2")]
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "5")]
void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae)
{
}
// Token: 0x0400114E RID: 4430
[global::Cpp2IlInjected.FieldOffset(Offset = "0x58")]
[Token(Token = "0x400114E")]
internal SemaphoreSlim.TaskNode Prev;
// Token: 0x0400114F RID: 4431
[global::Cpp2IlInjected.FieldOffset(Offset = "0x60")]
[Token(Token = "0x400114F")]
internal SemaphoreSlim.TaskNode Next;
}
}
}