C# Class System.Threading.ReaderWriterLock.ThreadLocalLockEntry

Stores thread-local lock info and manages the association of this info with each ReaderWriterLock owned by a thread. The original code maintained lists of thread-local lock entries on the CLR's thread objects, and manually released lock entries, which involved walking through all threads. While this is possible with ThreadLocal, this implementation prefers to use a similar design to that from ReaderWriterLockSlim, and allow reusing free entries without removing entries, since it is unlikely that the list length for any thread would get unreasonably long.
显示文件 Open project: dotnet/corefx

Public Properties

Property Type Description
_readerLevel ushort

Public Methods

Method Description
GetCurrent ( long lockID ) : ThreadLocalLockEntry
GetOrCreateCurrent ( long lockID ) : ThreadLocalLockEntry
HasLockID ( long lockID ) : bool

Private Methods

Method Description
GetOrCreateCurrentSlow ( long lockID, ThreadLocalLockEntry headEntry ) : ThreadLocalLockEntry
ThreadLocalLockEntry ( long lockID ) : System.Diagnostics
VerifyNoNonemptyEntryInListAfter ( long lockID, ThreadLocalLockEntry afterEntry ) : void

Method Details

GetCurrent() public static method

public static GetCurrent ( long lockID ) : ThreadLocalLockEntry
lockID long
return ThreadLocalLockEntry

GetOrCreateCurrent() public static method

public static GetOrCreateCurrent ( long lockID ) : ThreadLocalLockEntry
lockID long
return ThreadLocalLockEntry

HasLockID() public method

public HasLockID ( long lockID ) : bool
lockID long
return bool

Property Details

_readerLevel public_oe property

public ushort _readerLevel
return ushort