SemaphoreSlim.Release Método

Definição

Libera o objeto SemaphoreSlim.Releases the SemaphoreSlim object.

Sobrecargas

Release()

Libera o objeto SemaphoreSlim uma única vez.Releases the SemaphoreSlim object once.

Release(Int32)

Libera o objeto SemaphoreSlim um número de vezes especificado.Releases the SemaphoreSlim object a specified number of times.

Release()

Libera o objeto SemaphoreSlim uma única vez.Releases the SemaphoreSlim object once.

public:
 int Release();
public int Release ();
member this.Release : unit -> int
Public Function Release () As Integer

Retornos

Int32

A contagem anterior do SemaphoreSlim.The previous count of the SemaphoreSlim.

Exceções

A instância atual já foi descartada.The current instance has already been disposed.

O SemaphoreSlim já atingiu seu tamanho máximo.The SemaphoreSlim has already reached its maximum size.

Comentários

Uma chamada para o Release() método incrementa a CurrentCount Propriedade por um.A call to the Release() method increments the CurrentCount property by one. Se o valor da CurrentCount propriedade for zero antes que esse método seja chamado, o método também permitirá que um thread ou tarefa seja bloqueado por uma chamada para o Wait WaitAsync método ou para inserir o semáforo.If the value of the CurrentCount property is zero before this method is called, the method also allows one thread or task blocked by a call to the Wait or WaitAsync method to enter the semaphore.

Aplica-se a

Release(Int32)

Libera o objeto SemaphoreSlim um número de vezes especificado.Releases the SemaphoreSlim object a specified number of times.

public:
 int Release(int releaseCount);
public int Release (int releaseCount);
member this.Release : int -> int
Public Function Release (releaseCount As Integer) As Integer

Parâmetros

releaseCount
Int32

O número de vezes para sair do sinal.The number of times to exit the semaphore.

Retornos

Int32

A contagem anterior do SemaphoreSlim.The previous count of the SemaphoreSlim.

Exceções

A instância atual já foi descartada.The current instance has already been disposed.

releaseCount é menor que 1.releaseCount is less than 1.

O SemaphoreSlim já atingiu seu tamanho máximo.The SemaphoreSlim has already reached its maximum size.

Comentários

Uma chamada para o Release(Int32) método incrementa a CurrentCount Propriedade por releaseCount .A call to the Release(Int32) method increments the CurrentCount property by releaseCount. Se o valor da CurrentCount propriedade for zero antes que esse método seja chamado, o método também permitirá que releaseCount threads ou tarefas sejam bloqueadas por uma chamada para o Wait WaitAsync método ou para inserir o semáforo.If the value of the CurrentCount property is zero before this method is called, the method also allows releaseCount threads or tasks blocked by a call to the Wait or WaitAsync method to enter the semaphore.

Aplica-se a