ReaderWriterLockSlim.WaitingReadCount 속성

정의

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

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

속성 값

Int32

읽기 모드를 시작하려고 대기 중인 스레드의 총 개수입니다.

예제

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

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

설명

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

적용 대상