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

◆ ExitWriteLock()

void System.Threading.ReaderWriterLockSlim.ExitWriteLock ( )
inline

Definition at line 868 of file ReaderWriterLockSlim.cs.

869 {
870 if (!_fIsReentrant)
871 {
872 if (Environment.CurrentManagedThreadId != _writeLockOwnerId)
873 {
874 throw new SynchronizationLockException(SR.SynchronizationLockException_MisMatchedWrite);
875 }
876 _spinLock.Enter(EnterSpinLockReason.ExitAnyWrite);
877 }
878 else
879 {
880 _spinLock.Enter(EnterSpinLockReason.ExitAnyWrite);
881 ReaderWriterCount threadRWCount = GetThreadRWCount(dontAllocate: false);
882 if (threadRWCount == null)
883 {
884 _spinLock.Exit();
885 throw new SynchronizationLockException(SR.SynchronizationLockException_MisMatchedWrite);
886 }
887 if (threadRWCount.writercount < 1)
888 {
889 _spinLock.Exit();
890 throw new SynchronizationLockException(SR.SynchronizationLockException_MisMatchedWrite);
891 }
892 threadRWCount.writercount--;
893 if (threadRWCount.writercount > 0)
894 {
895 _spinLock.Exit();
896 return;
897 }
898 }
902 }
ReaderWriterCount GetThreadRWCount(bool dontAllocate)

References System.Threading.ReaderWriterLockSlim._fIsReentrant, System.Threading.ReaderWriterLockSlim._spinLock, System.Threading.ReaderWriterLockSlim._writeLockOwnerId, System.Threading.ReaderWriterLockSlim.ClearWriterAcquired(), System.Environment.CurrentManagedThreadId, System.Threading.ReaderWriterLockSlim.SpinLock.Enter(), System.Threading.ReaderWriterLockSlim.SpinLock.Exit(), System.Threading.ReaderWriterLockSlim.ExitAndWakeUpAppropriateWaiters(), System.Threading.ReaderWriterLockSlim.GetThreadRWCount(), System.SR.SynchronizationLockException_MisMatchedWrite, and System.Threading.ReaderWriterCount.writercount.

Referenced by System.Data.Index.AddRef(), System.Text.CodePagesEncodingProvider.GetEncoding(), System.Data.Index.RemoveRef(), and System.Security.AccessControl.ObjectSecurity< T >.WriteUnlock().