System.Threading.SemaphoreFullException Class

The exception that is thrown when the erload:System.Threading.Semaphore.Release method is called on a semaphore whose count is already at the maximum.

See Also: SemaphoreFullException Members


[System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class SemaphoreFullException : SystemException


The count on a semaphore is decremented each time a thread enters the semaphore, and incremented when a thread releases the semaphore. When the count is zero, subsequent requests block until other threads release the semaphore. When all threads have released the semaphore, the count is at the maximum value specified when the semaphore was created. If a programming error causes a thread to call the erload:System.Threading.Semaphore.Release method at this point, a System.Threading.SemaphoreFullException is thrown.


The System.Threading.Semaphore class does not enforce thread identity on calls to the erload:System.Threading.WaitHandle.WaitOne and erload:System.Threading.Semaphore.Release methods. It is not necessary for the same thread that called erload:System.Threading.WaitHandle.WaitOne to call erload:System.Threading.Semaphore.Release.

System.Threading.SemaphoreFullException does not necessarily indicate a problem with the code where the exception occurred. Consider the following scenario: Thread A and thread B enter a semaphore that has a maximum count of two. A programming error in thread B causes it to call erload:System.Threading.Semaphore.Release twice, so that the count on the semaphore is full. As a result, when thread A eventually calls erload:System.Threading.Semaphore.Release, a System.Threading.SemaphoreFullException is thrown.

For a list of initial property values for an instance of the System.Threading.SemaphoreFullException class, see the SemaphoreFullException.#ctor constructor.


Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: