ReaderWriterLockSlim.WaitingUpgradeCount Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient le nombre total de threads qui attendent d’entrer le verrou en mode pouvant être mis à niveau.
public:
property int WaitingUpgradeCount { int get(); };
public int WaitingUpgradeCount { get; }
member this.WaitingUpgradeCount : int
Public ReadOnly Property WaitingUpgradeCount As Integer
Valeur de propriété
Nombre total de threads qui attendent d’entrer en mode pouvant être mis à niveau.
Exemples
L’exemple suivant montre comment utiliser la WaitingUpgradeCount propriété pour générer une entrée de journal des événements si le nombre de threads bloqués, en attente d’entrer en mode pouvant être mis à niveau, dépasse un seuil.
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
Remarques
Utilisez cette propriété uniquement pour le débogage, le profilage et la journalisation, et non pour contrôler le comportement d’un algorithme. Les résultats peuvent changer dès qu’ils ont été calculés. Par conséquent, il n’est pas sûr de prendre des décisions en fonction de cette propriété.