Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
WaitingReadCount Property

ReaderWriterLockSlim.WaitingReadCount Property

Gets the total number of threads that are waiting to enter the lock in read mode.

Namespace:  System.Threading
Assemblies:   System.Threading (in System.Threading.dll)
  System.Core (in System.Core.dll)

public int WaitingReadCount { get; }

Property Value

Type: System.Int32
The total number of threads that are waiting to enter read mode.

Use this property only for debugging, profiling, and logging purposes, and not to control the behavior of an algorithm. The results can change as soon as they have been calculated. Therefore, it is not safe to make decisions based on this property.

The following example shows how to use the WaitingReadCount property to generate an event log entry if the number of threads that are blocked, waiting to enter read mode, exceeds a threshold.

using (ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim()) {


int waitingReadCt = rwLock.WaitingReadCount;
if (waitingReadCt > READ_THRESHOLD)
        "{0} blocked reader threads; exceeds recommended maximum.", 

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
© 2015 Microsoft