Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ RestoreLock()

void System.Threading.ReaderWriterLock.RestoreLock ( ref LockCookie lockCookie)
inline

Definition at line 718 of file ReaderWriterLock.cs.

719 {
721 if (lockCookie._threadID != currentThreadID)
722 {
724 }
725 if (_writerID == currentThreadID || ThreadLocalLockEntry.GetCurrent(_lockID) != null)
726 {
727 throw new SynchronizationLockException(System.SR.ReaderWriterLock_RestoreLockWithOwnedLocks);
728 }
729 LockCookieFlags flags = lockCookie._flags;
730 if (((uint)flags & 0xFFF89FFFu) != 0)
731 {
733 }
734 if ((flags & LockCookieFlags.OwnedNone) == 0)
735 {
736 if ((flags & LockCookieFlags.OwnedWriter) != 0)
737 {
738 if (Interlocked.CompareExchange(ref _state, 4096, 0) == 0)
739 {
741 _writerLevel = lockCookie._writerLevel;
743 goto IL_00e5;
744 }
745 }
746 else if ((flags & LockCookieFlags.OwnedReader) != 0)
747 {
748 ThreadLocalLockEntry orCreateCurrent = ThreadLocalLockEntry.GetOrCreateCurrent(_lockID);
749 int state = _state;
750 if (state < 1023 && Interlocked.CompareExchange(ref _state, state + 1, state) == state)
751 {
753 goto IL_00e5;
754 }
755 }
756 RecoverLock(ref lockCookie, flags);
757 }
758 goto IL_00e5;
759 IL_00e5:
760 lockCookie._flags = LockCookieFlags.Invalid;
761 }
static string ReaderWriterLock_RestoreLockWithOwnedLocks
Definition SR.cs:58
Definition SR.cs:7
void RecoverLock(ref LockCookie lockCookie, LockCookieFlags flags)
static ApplicationException GetInvalidLockCookieException()

References System.Threading.ReaderWriterLock._lockID, System.Threading.ReaderWriterLock._state, System.Threading.ReaderWriterLock._writerID, System.Threading.ReaderWriterLock._writerLevel, System.Threading.ReaderWriterLock._writerSeqNum, System.Threading.Interlocked.CompareExchange(), System.Runtime.Serialization.Dictionary, System.Threading.ReaderWriterLock.ThreadLocalLockEntry.GetCurrent(), System.Threading.ReaderWriterLock.GetCurrentThreadID(), System.Threading.ReaderWriterLock.GetInvalidLockCookieException(), System.Threading.ReaderWriterLock.ThreadLocalLockEntry.GetOrCreateCurrent(), System.SR.ReaderWriterLock_RestoreLockWithOwnedLocks, System.Threading.ReaderWriterLock.RecoverLock(), and System.state.