ReaderWriterLockSlim.RecursiveUpgradeCount 屬性


取得目前執行緒已進入可升級模式鎖定的次數,做為遞迴的表示。Gets the number of times the current thread has entered the lock in upgradeable mode, as an indication of recursion.

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


如果目前線程尚未進入可升級模式, 則為 0, 如果執行緒已進入可升級模式, 但是尚未以遞迴方式進入, 則為 1; 如果執行緒已遞迴進入可升級模式n -1 次, 則為n0 if the current thread has not entered upgradeable mode, 1 if the thread has entered upgradeable mode but has not entered it recursively, or n if the thread has entered upgradeable mode recursively n - 1 times.


此屬性僅適用于偵錯工具、分析和記錄用途, 而不是用來控制演算法的行為。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.