System.Threading.SemaphoreSlim Members

The members of System.Threading.SemaphoreSlim are listed below.

See Also: Inherited members from System.Object

Public Constructors

Initializes a new instance of the System.Threading.SemaphoreSlim class, specifying the initial number of requests that can be granted concurrently.

Initializes a new instance of the System.Threading.SemaphoreSlim class, specifying the initial and maximum number of requests that can be granted concurrently.

Public Properties

[read-only]
AvailableWaitHandleWaitHandle.

Returns a System.Threading.WaitHandle that can be used to wait on the semaphore.

[read-only]
CurrentCountint.

Gets the number of threads that will be allowed to enter the System.Threading.SemaphoreSlim.

Public Methods

Dispose()

Releases all resources used by the current instance of the System.Threading.SemaphoreSlim class.

Release() : int

Exits the System.Threading.SemaphoreSlim once.

Release(int) : int

Exits the System.Threading.SemaphoreSlim a specified number of times.

Wait()

Blocks the current thread until it can enter the System.Threading.SemaphoreSlim.

Wait(int) : bool

Blocks the current thread until it can enter the System.Threading.SemaphoreSlim, using a 32-bit signed integer that specifies the timeout.

Wait(CancellationToken)

Blocks the current thread until it can enter the System.Threading.SemaphoreSlim, while observing a System.Threading.CancellationToken.

Wait(TimeSpan) : bool

Blocks the current thread until it can enter the System.Threading.SemaphoreSlim, using a TimeSpan to specify the timeout.

Wait(int, CancellationToken) : bool

Blocks the current thread until it can enter the System.Threading.SemaphoreSlim, using a 32-bit signed integer that specifies the timeout, while observing a System.Threading.CancellationToken.

Wait(TimeSpan, CancellationToken) : bool

Blocks the current thread until it can enter the System.Threading.SemaphoreSlim, using a TimeSpan that specifies the timeout, while observing a System.Threading.CancellationToken.

WaitAsync() : System.Threading.Tasks.Task

Asynchronously waits to enter the System.Threading.SemaphoreSlim.

WaitAsync(int) : System.Threading.Tasks.Task<bool>

Asynchronously waits to enter the System.Threading.SemaphoreSlim, using a 32-bit signed integer to measure the time interval.

WaitAsync(CancellationToken) : System.Threading.Tasks.Task

Asynchronously waits to enter the System.Threading.SemaphoreSlim, while observing a System.Threading.CancellationToken.

WaitAsync(TimeSpan) : System.Threading.Tasks.Task<bool>

Asynchronously waits to enter the System.Threading.SemaphoreSlim, using a TimeSpan to measure the time interval.

WaitAsync(int, CancellationToken) : System.Threading.Tasks.Task<bool>

Asynchronously waits to enter the System.Threading.SemaphoreSlim, using a 32-bit signed integer to measure the time interval, while observing a System.Threading.CancellationToken.

WaitAsync(TimeSpan, CancellationToken) : System.Threading.Tasks.Task<bool>

Asynchronously waits to enter the System.Threading.SemaphoreSlim, using a TimeSpan to measure the time interval, while observing a System.Threading.CancellationToken.

Protected Methods

Dispose(bool)

Releases the unmanaged resources used by the System.Threading.SemaphoreSlim, and optionally releases the managed resources.