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

◆ ExitUpgradeableReadLock()

void System.Threading.ReaderWriterLockSlim.ExitUpgradeableReadLock ( )
inline

Definition at line 904 of file ReaderWriterLockSlim.cs.

905 {
906 if (!_fIsReentrant)
907 {
908 if (Environment.CurrentManagedThreadId != _upgradeLockOwnerId)
909 {
910 throw new SynchronizationLockException(SR.SynchronizationLockException_MisMatchedUpgrade);
911 }
913 }
914 else
915 {
917 ReaderWriterCount threadRWCount = GetThreadRWCount(dontAllocate: true);
918 if (threadRWCount == null)
919 {
920 _spinLock.Exit();
921 throw new SynchronizationLockException(SR.SynchronizationLockException_MisMatchedUpgrade);
922 }
923 if (threadRWCount.upgradecount < 1)
924 {
925 _spinLock.Exit();
926 throw new SynchronizationLockException(SR.SynchronizationLockException_MisMatchedUpgrade);
927 }
928 threadRWCount.upgradecount--;
929 if (threadRWCount.upgradecount > 0)
930 {
931 _spinLock.Exit();
932 return;
933 }
935 }
936 _owners--;
939 }
ReaderWriterCount GetThreadRWCount(bool dontAllocate)

References System.Threading.ReaderWriterLockSlim._fIsReentrant, System.Threading.ReaderWriterLockSlim._fUpgradeThreadHoldingRead, System.Threading.ReaderWriterLockSlim._owners, System.Threading.ReaderWriterLockSlim._spinLock, System.Threading.ReaderWriterLockSlim._upgradeLockOwnerId, System.Environment.CurrentManagedThreadId, System.Threading.ReaderWriterLockSlim.SpinLock.Enter(), System.Threading.ReaderWriterLockSlim.SpinLock.Exit(), System.Threading.ReaderWriterLockSlim.ExitAndWakeUpAppropriateWaiters(), System.Threading.ReaderWriterLockSlim.GetThreadRWCount(), System.SR.SynchronizationLockException_MisMatchedUpgrade, and System.Threading.ReaderWriterCount.upgradecount.

Referenced by System.Text.CodePagesEncodingProvider.GetEncoding(), and System.Data.DataTable.GetIndex().