Limits the number of threads that can access a resource or pool of resources concurrently.
Namespace:
System.Threading
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
<ComVisibleAttribute(False)> _ <HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization := True, _ ExternalThreading := True)> _ Public Class SemaphoreSlim _ Implements IDisposable |
C# |
---|
[ComVisibleAttribute(false)] [HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true, ExternalThreading = true)] public class SemaphoreSlim : IDisposable |
Remarks
The SemaphoreSlim provides a lightweight semaphore class that doesn't use Windows kernel semaphores.
All public and protected members of SemaphoreSlim are thread-safe and may be used concurrently from multiple threads, with the exception of Dispose, which must only be used when all other operations on the SemaphoreSlim have completed.
Inheritance Hierarchy
System..::.Object
System.Threading..::.SemaphoreSlim
System.Threading..::.SemaphoreSlim