ReaderWriterLockSlim.WaitingUpgradeCount Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the total number of threads that are waiting to enter the lock in upgradeable mode.
public:
property int WaitingUpgradeCount { int get(); };
public int WaitingUpgradeCount { get; }
member this.WaitingUpgradeCount : int
Public ReadOnly Property WaitingUpgradeCount As Integer
Property Value
The total number of threads that are waiting to enter upgradeable mode.
Examples
The following example shows how to use the WaitingUpgradeCount property to generate an event log entry if the number of threads that are blocked, waiting to enter upgradeable mode, exceeds a threshold.
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
Remarks
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.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈