SemaphoreSlim 생성자

정의

SemaphoreSlim 클래스의 새 인스턴스를 초기화합니다.

오버로드

SemaphoreSlim(Int32)

동시에 부여할 수 있는 초기 요청 수를 지정하여 SemaphoreSlim 클래스의 새 인스턴스를 초기화합니다.

SemaphoreSlim(Int32, Int32)

동시에 부여할 수 있는 초기 및 최대 요청 수를 지정하여 SemaphoreSlim 클래스의 새 인스턴스를 초기화합니다.

SemaphoreSlim(Int32)

동시에 부여할 수 있는 초기 요청 수를 지정하여 SemaphoreSlim 클래스의 새 인스턴스를 초기화합니다.

public:
 SemaphoreSlim(int initialCount);
public SemaphoreSlim (int initialCount);
new System.Threading.SemaphoreSlim : int -> System.Threading.SemaphoreSlim
Public Sub New (initialCount As Integer)

매개 변수

initialCount
Int32

세마포에 동시에 부여할 수 있는 초기 요청 수입니다.

예외

initialCount 가 0보다 작습니다.

설명

매개 변수는 initialCount 부여할 수 있는 세마포를 입력하기 위한 동시 요청 수를 정의합니다. 그러나 동시에 부여할 수 있는 최대 요청 수는 정의하지 않습니다. SemaphoreSlim 이 생성자를 호출하여 인스턴스화된 개체는 메서드를 호출 Release 하면 속성 값이 그 이상으로 initialCount증가하는 경우 예외를 CurrentCount throw SemaphoreFullException 하지 않습니다. 이 문제는 메서드에 대한 호출 Release 이 메서드 또는 WaitAsync 메서드보다 더 많은 Wait 경우 발생합니다. 부여할 수 있는 세마포를 입력하기 위한 최대 동시 요청 수를 설정하려면 생성자를 호출 SemaphoreSlim(Int32, Int32) 합니다.

추가 정보

적용 대상

SemaphoreSlim(Int32, Int32)

동시에 부여할 수 있는 초기 및 최대 요청 수를 지정하여 SemaphoreSlim 클래스의 새 인스턴스를 초기화합니다.

public:
 SemaphoreSlim(int initialCount, int maxCount);
public SemaphoreSlim (int initialCount, int maxCount);
new System.Threading.SemaphoreSlim : int * int -> System.Threading.SemaphoreSlim
Public Sub New (initialCount As Integer, maxCount As Integer)

매개 변수

initialCount
Int32

세마포에 동시에 부여할 수 있는 초기 요청 수입니다.

maxCount
Int32

세마포에 동시에 부여할 수 있는 최대 요청 수입니다.

예외

initialCount가 0보다 작거나 initialCountmaxCount보다 크거나 maxCount가 0보다 작거나 같은 경우.

추가 정보

적용 대상