ReaderWriterLockSlim.WaitingUpgradeCount 속성

정의

업그레이드 가능 모드로 잠금을 시작하려고 대기 중인 스레드의 총 개수를 가져옵니다.

public:
 property int WaitingUpgradeCount { int get(); };
public int WaitingUpgradeCount { get; }
member this.WaitingUpgradeCount : int
Public ReadOnly Property WaitingUpgradeCount As Integer

속성 값

Int32

업그레이드 가능 모드를 시작하려고 대기 중인 스레드의 총 개수입니다.

예제

다음 예제에서는 업그레이드 가능 모드로 전환되기를 기다리는 차단된 스레드 수가 임계값을 초과하는 경우 이 속성을 사용하여 WaitingUpgradeCount 이벤트 로그 항목을 생성하는 방법을 보여 줍니다.

using (ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim()) {
Using rwLock As New ReaderWriterLockSlim()
int waitingUpgradeableReadCt = rwLock.WaitingUpgradeCount;
if (waitingUpgradeableReadCt > UPGRADEABLEREAD_THRESHOLD)
{
    performanceLog.WriteEntry(String.Format(
        "{0} blocked upgradeable reader threads; exceeds recommended maximum.", 
        waitingUpgradeableReadCt));
}
Dim waitingUpgradeableReadCt As Integer = rwLock.WaitingUpgradeCount
If waitingUpgradeableReadCt > UPGRADEABLEREAD_THRESHOLD Then
    performanceLog.WriteEntry(String.Format( _
        "{0} blocked upgradeable reader threads; exceeds recommended maximum.", _
        waitingUpgradeableReadCt))
End If

설명

이 속성은 디버깅, 프로파일링 및 로깅 목적으로만 사용하고 알고리즘의 동작을 제어하지 않습니다. 결과는 계산되는 즉시 변경됩니다. 따라서 이 속성에 따라 결정을 내리는 것은 안전하지 않습니다.

적용 대상