System.Threading.ReaderWriterLock.ThreadLocalLockEntry.GetCurrent C# (CSharp) Method

GetCurrent() public static method

public static GetCurrent ( long lockID ) : ThreadLocalLockEntry
lockID long
return ThreadLocalLockEntry
            public static ThreadLocalLockEntry GetCurrent(long lockID)
            {
                Debug.Assert(lockID != 0);

                ThreadLocalLockEntry headEntry = t_lockEntryHead;
                for (ThreadLocalLockEntry currentEntry = headEntry; currentEntry != null; currentEntry = currentEntry._next)
                {
                    if (currentEntry._lockID == lockID)
                    {
                        VerifyNoNonemptyEntryInListAfter(lockID, currentEntry);

                        // The lock ID assignment is only relevant when the entry is not empty, since the lock ID is not reset
                        // when its state becomes empty. Empty entries can be poached by other ReaderWriterLocks.
                        return currentEntry.IsFree ? null : currentEntry;
                    }
                }
                return null;
            }